removing AD user attributes?

Posted on 2004-11-03
Last Modified: 2011-10-14
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 = ""

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?
Question by:browolf
    LVL 20

    Accepted Solution

    LVL 3

    Author Comment

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


    Expert Comment

    this link doesnt exist please post remedy inline...

    Expert Comment

    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

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

    please help thx

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    NTFS file system has been developed by Microsoft that is widely used by Windows NT operating system and its advanced versions. It is the mostly used over FAT file system as it provides superior features like reliability, security, storage, efficienc…
    When we have a dead host and we lose all connections to the ESXi, and we need to find a way to move all VMs from that dead ESXi host.
    It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now