none
is it possible to add value to the attributes of <not set> in ADSIedit? RRS feed

  • Question

  • I had been using PowerShell version 3 and use LDAP query to query out both attributes and value from Active Directory. 

    Is it possible to use powershell script to set value to the description attributes which had been written as <not set> in ADSIedit?

    Or I need to change the the ADSIedit <not set> value before I am able to add value to <not set> description attributes?

    Friday, June 20, 2014 3:36 AM

Answers

  • hi, sorry for the late reply. I had found the answer that it the value can be added from window powershell 2 for dummies.

    this is the code:

    $user = [adsi]”LDAP://CN=testuser,ou=test,dc=testlab,dc=local”
    $user.put(“givenName”,”Chris”)
    $user.put(“description”,”Master of Disaster”)
    $user.SetInfo()


    • Edited by noobycy Monday, June 30, 2014 3:26 AM
    • Marked as answer by noobycy Tuesday, July 1, 2014 1:08 AM
    Sunday, June 29, 2014 10:10 PM

All replies

  • What do you mean you are using LDAP query.  Do you mean AD CmdLets?  Are you asking about the DirectorrySearcher?  Ado Query Provider for AD?

    What is LDAP in PowerShell.  LDAP is a protocol/syntax used by AD.

    Why would you not be able to change the description?

    Set-AdUser someuser -Description 'this is a description'

    See: http://technet.microsoft.com/en-us/library/ee617215.aspx

    See also:http://www.webopedia.com/TERM/L/LDAP.html


    ¯\_(ツ)_/¯

    Friday, June 20, 2014 4:01 AM
  • One thing I should have mentioned I that there is a very  good collection of scripts in the repository here: http://gallery.technet.microsoft.com/

    You will see many examples of how to use AD and how to set the description on objects.

    Since you do not know AD and it's technology I highly recommend staying away from ADSIEdit.  It is almost never needed or used except to extend or repair AD. It is not used to change data in AD.  It is not a tool you want to play with and it can totally destroy your AD installation very quickly,


    ¯\_(ツ)_/¯

    Friday, June 20, 2014 4:42 AM
  • hi, sorry for the late reply. I had found the answer that it the value can be added from window powershell 2 for dummies.

    this is the code:

    $user = [adsi]”LDAP://CN=testuser,ou=test,dc=testlab,dc=local”
    $user.put(“givenName”,”Chris”)
    $user.put(“description”,”Master of Disaster”)
    $user.SetInfo()


    • Edited by noobycy Monday, June 30, 2014 3:26 AM
    • Marked as answer by noobycy Tuesday, July 1, 2014 1:08 AM
    Sunday, June 29, 2014 10:10 PM
  • Well that is kind of dated.  PowerShell lets us do this directly:

    $user = [adsi]”LDAP://CN=testuser,ou=test,dc=testlab,dc=local”
    $user.givenName='Chris'
    $user.Description='Master of Disaster'
    $user.CommitChanges()

    The book is not wrong it is just a bit dated.

    The book is a good starter.  It will get you into PowerShell.  When finished look into some of the newer books.


    ¯\_(ツ)_/¯



    • Edited by jrv Sunday, June 29, 2014 10:46 PM
    Sunday, June 29, 2014 10:46 PM
  • Hi jrv,
    Do you still have any book recommend for beginner like me to read? Because I am still learning the powershell in slow and messy way.. (Self-learning and coding not so good)

    For the code, I having error.. This is what it wrote on the screen

    Exception setting "description": "the following exception occurred while retrieving member "description": "the unknown error (0x80005000)" "
    Monday, June 30, 2014 3:33 AM
  • The error indicates that the object is missing.

    Here are some books: http://technet.microsoft.com/en-us/scriptcenter/dd793612.aspx


    ¯\_(ツ)_/¯


    • Edited by jrv Monday, June 30, 2014 4:05 AM
    Monday, June 30, 2014 3:58 AM
  • Hi jrv,
    The object is missing because Powershell unable to retrieve the '<not set>' null properties value from the active directory?

    Noobycy
    • Edited by noobycy Tuesday, July 1, 2014 1:13 AM
    Tuesday, July 1, 2014 1:12 AM
  • Hi jrv,
    The object is missing because Powershell unable to retrieve the '<not set>' null properties value from the active directory?

    Noobycy

    You may have issues with your Net installation or with AD.  My version works as it should on al versions of AD.

    Description and givenName are fixed attributes on AD.  They are not optional.  Perhaps you altered them with ADSIEdit whish is a good way to break AD.


    ¯\_(ツ)_/¯

    Tuesday, July 1, 2014 1:16 AM
  • Hi jrv,
    Will using server 2003 is a problem? I know that most command can't work because of the server version... And also heard that powershell did not fully install..

    Noobycy
    Tuesday, July 1, 2014 2:54 AM
  • I tested on Ws2003.  You have issues.  Perhaps you should fix you AAD and PowerShell installation.

    PowerShell has always run on Server 2003.  I have run it with ADSI for years.  It is what we used before WS2008R2 introduced the AD CmdLets.


    ¯\_(ツ)_/¯

    Tuesday, July 1, 2014 2:57 AM
  • Hi jrv,
    Due to some situation, I can't fix it even though I want to.
    Noobcy
    Tuesday, July 1, 2014 3:30 AM
  • Well I guess you are out of luck.  Sorry.


    ¯\_(ツ)_/¯

    Tuesday, July 1, 2014 3:43 AM