browolf
asked on
removing AD user attributes?
i recently discovered our login script is running twice cos it's in the group policy and on the user profile 'login script' attribute. a legacy from migrating from NT no doubt
have tried to create a vbscript to wipe the attributes but there's a problem. it works if i try and set the value to something else but fails if i try to set it to ""
set objParent = GetObject("LDAP://ou=pupil s,dc=domai n")
objParent.Filter = Array("user")
for each objUser in objParent
Wscript.Echo "Modifying " & objUser.Get("sAMAccountNam e")
objUser.ScriptPath = ""
objUser.SetInfo
next
with "" i get the error the attribute syntax specified to the directory service is invalid
with NULL i get the error unspecified error.
any ideas?
have tried to create a vbscript to wipe the attributes but there's a problem. it works if i try and set the value to something else but fails if i try to set it to ""
set objParent = GetObject("LDAP://ou=pupil
objParent.Filter = Array("user")
for each objUser in objParent
Wscript.Echo "Modifying " & objUser.Get("sAMAccountNam
objUser.ScriptPath = ""
objUser.SetInfo
next
with "" i get the error the attribute syntax specified to the directory service is invalid
with NULL i get the error unspecified error.
any ideas?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
this link doesnt exist please post remedy inline...
Since the Google Link is no longer available...
Im trying to perform this in VBscript.
I have 2 attributes I want to not just make null but delete them expongued from the User record.
strUserToPurge = InputBox("Type in the ID of user", "PURGE USER")
If InStr(strUserToPurge, "\") > 0 Then strUserToPurge = Mid(strUserToPurge, InStr(strUserToPurge, "\") + 1)
strUserPath = Get_LDAP_User_Properties(" user", "name", strMyDomain & "\" & strUserToPurge, "adspath", strConnUser, strConnPassword)
' Delete target Attribute strAttribute1 = "myattribute1"
Set objUser = GetObject(objRecordSet.Fie lds("strUs erPath").V alue)
objUser.PutEx ADS_PROPERTY_CLEAR, "myattribute1", 0 ' Completely erase
objUser.SetInfo
' Delete target Attribute strAttribute2 = "myattribute2"
Set objUser = GetObject(objRecordSet.Fie lds("strUs erPath").V alue)
objUser.PutEx ADS_PROPERTY_CLEAR, "myattribute2", 0 ' Completely erase
objUser.SetInfo
please help thx
Im trying to perform this in VBscript.
I have 2 attributes I want to not just make null but delete them expongued from the User record.
strUserToPurge = InputBox("Type in the ID of user", "PURGE USER")
If InStr(strUserToPurge, "\") > 0 Then strUserToPurge = Mid(strUserToPurge, InStr(strUserToPurge, "\") + 1)
strUserPath = Get_LDAP_User_Properties("
' Delete target Attribute strAttribute1 = "myattribute1"
Set objUser = GetObject(objRecordSet.Fie
objUser.PutEx ADS_PROPERTY_CLEAR, "myattribute1", 0 ' Completely erase
objUser.SetInfo
' Delete target Attribute strAttribute2 = "myattribute2"
Set objUser = GetObject(objRecordSet.Fie
objUser.PutEx ADS_PROPERTY_CLEAR, "myattribute2", 0 ' Completely erase
objUser.SetInfo
please help thx
ASKER
cheers.