Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Changing AD Properties with Powershell

 
Logged in as: Guest
arrSession:exec spGetSession 2,5,58491
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> Windows PowerShell >> Changing AD Properties with Powershell
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Changing AD Properties with Powershell - 3/28/2008 2:43:50 AM   
  spooter

 

Posts: 15
Score: 0
Joined: 11/14/2007
Status: offline
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.
 
 
Post #: 1
 
 RE: Changing AD Properties with Powershell - 3/31/2008 1:04:31 AM   
  ebgreen


Posts: 4411
Score: 29
Joined: 7/12/2005
Status: offline
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

(in reply to spooter)
 
 
Post #: 2
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> Windows PowerShell >> Changing AD Properties with Powershell Page: [1]
Jump to:





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
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts