ok, am getting an error on the following line
Code:
$objUser.Put "UserAccountControl", $newFlag
Error is "ERROR: Unexpected command"
here is the whole script (minus the actuall UDFs, but can post them if needed)
Code:
Break on
$sWhat = "Name","distinguishedName"
;$sFrom = "LDAP://OU=Security,OU=TMG,OU=IT,OU=CorpHQ,DC=handleman,DC=com"
$sFrom = "LDAP://OU=LAN,OU=PC Support,OU=TMG,OU=IT,OU=CorpHQ,DC=handleman,DC=com"
$sFilter = "(&(objectCategory=person)(objectClass=user)(userAccountControl:1.2.840.113556.1.4.803:=32))"
$aResults = fnLDAPQuery($sWhat,$sFrom,$sFilter,"Name")
@ERROR " | " @SERROR ??
For $r = 0 to Ubound($aResults,1)
$objUser = GetObject("LDAP://"+$aResults[$r,1])
;Region Change value
$flag = $objUser.Get("UserAccountControl")
$newFlag = $flag - 32
$objUser.Put "UserAccountControl", $newFlag
;$objUser.SetInfo
If Not @ERROR
$objUser.Name + " has been fixed." ?
Else
@ERROR " | " @SERROR ?
EndIf
Next
Get $
i am very new to using COM and ADSI, so any help as to why i get this error would be much appreciated