Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 403
  • Last Modified:

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?
0
browolf
Asked:
browolf
  • 2
1 Solution
 
Debsyl99Commented:
0
 
browolfAuthor Commented:
that's it.  knew it'd be something known. couldnt seem to find it myself.

cheers.
0
 
JAaron AndersonProgramming Architect @ Widener UniversityCommented:
this link doesnt exist please post remedy inline...
0
 
JAaron AndersonProgramming Architect @ Widener UniversityCommented:
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
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now