Jump to content

Recommended Posts

Posted

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....


Posted (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 Next

Const ADS_SCOPE_SUBTREE = 2

strPassword = ""

Set objConnection = CreateObject("ADODB.Connection")
Set objCommand = CreateObject("ADODB.Command")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
Set objCommand.ActiveConnection = objConnection

objCommand.Properties("Page Size") = 1000
objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE

objCommand.CommandText = _
"SELECT AdsPath FROM 'LDAP://dc=fabrikam,dc=com' WHERE objectCategory='user'"
Set objRecordSet = objCommand.Execute

objRecordSet.MoveFirst
Do 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.MoveNext
Loop

Edited by cluberti

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...