piektdiena, 2012. gada 16. novembris

Add bulk email addresses to users in Windows 2008 via PowerShell script

This script just add parameter email to every user in the csv list. Idea was taken from here http://social.technet.microsoft.com/Forums/en/winserverDS/thread/ade706c8-eef8-4c3a-b81d-e3af8677747b  I was looking for full solution and find this script, however there are not full description so I had to write my own, so here is full solution.

And script itself.

Import-Module ActiveDirectory 
$Users = Import-Csv -Delimiter ";" -Path ".\maillist.csv"  
foreach ($User in $Users)  
{  
    $POST = $User.Pasts  
    $SAM =  $User.Name 
    Set-ADUser -Identity $SAM -email $POST 
}

Script is looking for csv file in the same dirtectory where ps file. Dont forget to test user properties, whether email address appears. Of course, you can change other parameters too. Before run ps files on domain controller, security must be changed,

Nav komentāru:

Ierakstīt komentāru