I am trying to modify active Directory user’s expiry date using the following script
strExpireDate = "23/10/2007"
strUserDN = "cn=testkm,ou=test km laptops,DC=corp,DC=int,DC=mydomain,DC=gov,DC=uk"
set objUser = GetObject("LDAP://" & strUserDN)
objUser.AccountExpirationDate = strExpireDate
objUser.SetInfo
WScript.Echo "Set user " & strUserDN & " to expire on " & strExpireDate
The above works but it's only for one user. The problem is that I have a bunch of users in different ou's that need changing.
Is there a way to use an excel document which has the users names/usernames and use that as a source?
Any help will be appreciated before I throw my pc out of the window.
strExpireDate = "23/10/2007"
strUserDN = "cn=testkm,ou=test km laptops,DC=corp,DC=int,DC=mydomain,DC=gov,DC=uk"
set objUser = GetObject("LDAP://" & strUserDN)
objUser.AccountExpirationDate = strExpireDate
objUser.SetInfo
WScript.Echo "Set user " & strUserDN & " to expire on " & strExpireDate
The above works but it's only for one user. The problem is that I have a bunch of users in different ou's that need changing.
Is there a way to use an excel document which has the users names/usernames and use that as a source?
Any help will be appreciated before I throw my pc out of the window.