Interface Posted December 7, 2005 Posted December 7, 2005 Hi, How can I list blank password (no password) users in my win2K3 domain.I am aware that I can enforce GPO,password policy to have one for everyone. But I wannna list the users who doesn't have one before applying GPO. Any Script or Tools will do....
cluberti Posted December 7, 2005 Posted December 7, 2005 (edited) I did not write this, I got it from the Scripting Guys' site at Microsoft.com. It does work, so no need to reinvent the wheel :On Error Resume NextConst ADS_SCOPE_SUBTREE = 2strPassword = ""Set objConnection = CreateObject("ADODB.Connection")Set objCommand = CreateObject("ADODB.Command")objConnection.Provider = "ADsDSOObject"objConnection.Open "Active Directory Provider"Set objCommand.ActiveConnection = objConnectionobjCommand.Properties("Page Size") = 1000objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE objCommand.CommandText = _ "SELECT AdsPath FROM 'LDAP://dc=fabrikam,dc=com' WHERE objectCategory='user'" Set objRecordSet = objCommand.ExecuteobjRecordSet.MoveFirstDo Until objRecordSet.EOF strPath = objRecordSet.Fields("AdsPath").Value Set strUser= GetObject(strPath) strUser.ChangePassword strPassword, strPassword If Err= 0 or Err = -2147023569 Then Wscript.Echo strUser.CN End If Err.Clear objRecordSet.MoveNextLoop Edited December 7, 2005 by cluberti
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now