Link to home
Start Free TrialLog in
Avatar of browolf
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=pupils,dc=domain")
objParent.Filter = Array("user")
for each objUser in objParent
   Wscript.Echo "Modifying " & objUser.Get("sAMAccountName")
   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
Avatar of Debsyl99
Debsyl99

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of browolf
browolf

ASKER

that's it.  knew it'd be something known. couldnt seem to find it myself.

cheers.
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.Fields("strUserPath").Value)
            objUser.PutEx ADS_PROPERTY_CLEAR, "myattribute1", 0 ' Completely erase
      objUser.SetInfo


' Delete target Attribute       strAttribute2 = "myattribute2"
      Set objUser = GetObject(objRecordSet.Fields("strUserPath").Value)
            objUser.PutEx ADS_PROPERTY_CLEAR, "myattribute2", 0 ' Completely erase
      objUser.SetInfo


please help thx