Author Archives: dean132

Add a list of users to a Distribution Group with log file

This script will add a list of users in a text file to Distribution group and output the results to a log file.


Import-Module ActiveDirectory ## Use AD Snapin
Add-PSSnapin Microsoft.Exchange.Management.PowerShell.Admin ## Use Exchange 2007 Snapin
$AdminSessionADSettings.ViewEntireForest = $true ##Search Entire Forest

Get-Content ‘C:\Userlist.txt’ | %{
$User = $_
Try {
Add-DistributionGroupMember ‘GroupName’ -Member $User -EA STOP
}
Catch{
Echo $User $_.exception.Message
}
} | Out-File C:\scriptlog.txt

Facebooktwittergoogle_pluslinkedinby feather

Move OCS Users in an OU to Lync 2010

I used this script to migrate OCS 2007 R2 users to Lync 2010. On the contract I was working we had 6000 users to migrate across EMEA. Users were split into OUs for their Country, so we did this each night country by country.

Import-Module Lync
Get-CSUser -OU "OU=UK,DC=domain,DC=local" | %{
$User = $_
Try {
Move-CsLegacyUser -Target "lync-pool-name" -EA STOP
}
Catch{
Echo $User $_.exception.Message
}
} | Out-File C:\Lynclog.txt
Facebooktwittergoogle_pluslinkedinby feather