Lync Powershell Scripts for Bulk Import / Edit
08/01/2011 2 reacties
I have created some small scripts for bulk enable / import Lync users and a script for changing for example disable audio / video. I’m not a powershell script Guru, yet but maybe these scripts can help you out! The scripts are using a CSV file for import / edit these users.
Bulk import.ps1
param( [string] $importfile = $(Read-Host -prompt `
“Please enter a file name”))
$importedusers = Import-Csv $importfile
$transcriptname = “MoveorEnableUsers” + `
(Get-Date -format s).Replace(“:”,”-”) +”.txt”
Start-Transcript $transcriptname
foreach ($importeduser in $importedusers)
{
if ($importeduser.MoveorEnable -eq “Move”)
{
Move-CsUser $importeduser.SipUri -target `
$importeduser.Target -verbose
}
else
{
Enable-CsUser $importeduser.UPN -SipAddress `
$importeduser.SipUri -RegistrarPool `
$importeduser.Target -Verbose
}
}
Stop-Transcript
Bulk Edit
param( [string] $importfile = $(Read-Host -prompt `
“Please enter a file name”))
$importedusers = Import-Csv $importfile
$transcriptname = “BulkEdit” + `
(Get-Date -format s).Replace(“:”,”-”) +”.txt”
Start-Transcript $transcriptname
foreach ($importeduser in $importedusers)
{
Set-CsUser $importeduser.UPN -AudioVideoDisabled $True `
-Verbose
}
Stop-Transcript
Example CSV file:
SipUri,MoveorEnable,Target,UPN
sip:[SIPURI],Enable,”[FQDN LYNC POOL]“,[UPN]


Pingback: Enabeling users for Lync - Communified.net Blog
see the last lines of the script:
foreach ($importeduser in $importedusers)
{
Set-CsUser $importeduser.UPN -AudioVideoDisabled $True `
-Verbose
}
Stop-Transcript