I am trying to run a small VBScript to force a test user's AD password to expire (for the purpose of testing OWA reset).
I am logged onto my DC, as domain admin, for this test.
Here is the script I am using (names changed to protect the innocent):
' Bind to the user object in AD.
Set objUser = GetObject("LDAP://cn=JohnnyTest,ou=TestOU,dc=MyDomain,dc=com")
' Expire the password immediately.
objUser.pwdLastSet = 0
' Save the change in AD.
objUser.SetInfo
The OU TestOU is on the top level of my AD structure, and the account JohnnyTest@MyDomain.com is in there. (The display name under the Object tab is Test, Johnny - But when created,the account name was simply JohnnyTest)
Yet when I run this script, I get the following Windows Script Host error:
SCript: C:\Documents and Settings\Administrator.MyDomain\Desktop\ExpirePassword1.vbs
Line: 1
Char: 1
Error: There is no such object on the server.
Code: 80072030
Source: (null)
I am not sure where I am going wrong. I've repeatedly doublechecked that first line of the script, I have the user logon name from the Account tab of the AD account, JohnnyTest, then the OU "TestOU" which is where his account sits, then the DC hierarchy broken down from specific to general. What am I missing?