Changing AD Properties with Powershell

Author Message
spooter

  • Total Posts : 17
  • Scores: 0
  • Reward points : 0
  • Joined: 11/14/2007
  • Status: offline
Changing AD Properties with Powershell Friday, March 28, 2008 3:43 AM (permalink)
0
Hi all,
 
Not much activity here?
 
I am trying to a powershell script which users a CSV file which contains the users SamaccountName, Department and Title.  At the moment I have the below which works if I use the CN to find them but this isnt a unquie identifer so I need to use the samaccountname, any ideas on how this can be done?  I think I aslo need it to connect to the default ad route rather than taking the path from a CSV file.
 
$users = import-csv users.csv
foreach($row in $users)
{
$dn = $row.dn
$user=[ADSI]LDAP://$dn
 
$title = $row.title
$department = $row.department
 
$user.put("title", $title)
$user.put("department", $department)


$user.SetInfo()
}

 
 
Typed this up pretty quick so sorry if it doesnt make much sense.
 
#1
    ebgreen

    • Total Posts : 8219
    • Scores: 98
    • Reward points : 0
    • Joined: 7/12/2005
    • Status: offline
    RE: Changing AD Properties with Powershell Monday, March 31, 2008 2:04 AM (permalink)
    0
    I'm confused. It looks (from the naming used) that you are using the DN to get the account. Is that not sufficient?
    "... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
    Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
    http://www.visualbasicscript.com/m_47117/tm.htm
     
    #2

      Online Bookmarks Sharing: Share/Bookmark

      Jump to:

      Current active users

      There are 0 members and 1 guests.

      Icon Legend and Permission

      • New Messages
      • No New Messages
      • Hot Topic w/ New Messages
      • Hot Topic w/o New Messages
      • Locked w/ New Messages
      • Locked w/o New Messages
      • Read Message
      • Post New Thread
      • Reply to message
      • Post New Poll
      • Submit Vote
      • Post reward post
      • Delete my own posts
      • Delete my own threads
      • Rate post

      2000-2012 ASPPlayground.NET Forum Version 3.9