פקודות וסקריפטים לסביבת Lync\SfB

העברת משתמשים באמצעות קובץ CSV מול מזהה Identity

$cred=Get-Credential
Import-Csv sfbusers.csv -Header Identity | Foreach-Object {Move-CsUser -Identity $_.identity -Target sipfed.online.lync.com -Credential $creds -HostedMigrationOverrideUrl https://admin1e.online.lync.com/HostedMigration/hostedmigrationService.svc}

הגדרת משתמשים מול OU מסוים

Get-CsAdUser -OU “lab.local/LABUsers” -Filter { Enabled -ne $True -and WindowsEmailAddress -like ‘*@elishlomo.us’ } |
Enable-CsUser -RegistrarPool ‘fe.lab.local’ -SipAddressType emailaddress

הוצאת רשימה של כלל המשתמשים בשירות SfB Online

Get-CSOnlineUser | ? {$_.SipAddress -notlike $Null} | Select SipAddress, DisplayName | Export-CSV -Path C:\temp\SfBOnlineUsers.csv  –NoTypeInformation

הגדרת משתמשים בשירות SfB Online

$Users = Import-Csv C:\SfBOnlineUsers.csv

ForEach($User in $Users)

{

$SipAddress = $user.sipaddress

$UPN = $SipAddress.replace(“sip:”, “”)

$Enable = Enable-CsUser -Identity $UPN -SipAddress $SipAddress -HostingProviderProxyFqdn

“sipfed.online.lync.com”

}

הגדרת Auto Sign-in

#Get Current Domain
$domain = [System.DirectoryServices.ActiveDirectory.Domain]::GetCurrentDomain()
$domain = “DC=$($domain.Name.Replace(‘.’,’,DC=’))”
#Get the current username and SID
$CurrentUsername = $env:USERNAME
$CurrentUserSid = [System.Security.Principal.WindowsIdentity]::GetCurrent().User.Value
#Connect to Domain Controller and search with current username or SID #Only one object will be returned
$Searcher = New-Object DirectoryServices.DirectorySearcher
$Searcher.Filter = “(&(objectCategory=person)(objectSid=$($CurrentUserSid)))”
#$Searcher.Filter = “(&(objectCategory=person)(cn=$($CurrentUsername)))”
$Searcher.SearchRoot = “LDAP://$($domain)”
$User = $Searcher.FindOne()
$CurrentUpn = ([ADSI]$User.Path).userPrincipalName
 
If ($(Test-Path -Path “HKCU:\Software\Microsoft\Office\16.0\Lync”) -eq $False) { New-Item “HKCU:\Software\Microsoft\Office\16.0\Lync” }
New-ItemProperty “HKCU:\Software\Microsoft\Office\16.0\Lync” -Name “SavePassword” -Value 1 -PropertyType “DWord” -Force
New-ItemProperty “HKCU:\Software\Microsoft\Office\16.0\Lync” -Name “ServerSipUri” -Value $CurrentUpn -PropertyType “String” -Force
New-ItemProperty “HKCU:\Software\Microsoft\Office\16.0\Lync” -Name “ServerUsername” -Value $CurrentUpn -PropertyType “String” -Force

פקודות וסקריפטים לסביבת Lync\SfB

העברת משתמשים באמצעות קובץ CSV מול מזהה Identity

$cred=Get-Credential
Import-Csv sfbusers.csv -Header Identity | Foreach-Object {Move-CsUser -Identity $_.identity -Target sipfed.online.lync.com -Credential $creds -HostedMigrationOverrideUrl https://admin1e.online.lync.com/HostedMigration/hostedmigrationService.svc}

הגדרת משתמשים מול OU מסוים

Get-CsAdUser -OU “lab.local/LABUsers” -Filter { Enabled -ne $True -and WindowsEmailAddress -like ‘*@elishlomo.us’ } |
Enable-CsUser -RegistrarPool ‘fe.lab.local’ -SipAddressType emailaddress

הוצאת רשימה של כלל המשתמשים בשירות SfB Online

Get-CSOnlineUser | ? {$_.SipAddress -notlike $Null} | Select SipAddress, DisplayName | Export-CSV -Path C:\temp\SfBOnlineUsers.csv  –NoTypeInformation

הגדרת משתמשים בשירות SfB Online

$Users = Import-Csv C:\SfBOnlineUsers.csv

ForEach($User in $Users)

{

$SipAddress = $user.sipaddress

$UPN = $SipAddress.replace(“sip:”, “”)

$Enable = Enable-CsUser -Identity $UPN -SipAddress $SipAddress -HostingProviderProxyFqdn

“sipfed.online.lync.com”

}

הגדרת Auto Sign-in

#Get Current Domain
$domain = [System.DirectoryServices.ActiveDirectory.Domain]::GetCurrentDomain()
$domain = “DC=$($domain.Name.Replace(‘.’,’,DC=’))”
#Get the current username and SID
$CurrentUsername = $env:USERNAME
$CurrentUserSid = [System.Security.Principal.WindowsIdentity]::GetCurrent().User.Value
#Connect to Domain Controller and search with current username or SID #Only one object will be returned
$Searcher = New-Object DirectoryServices.DirectorySearcher
$Searcher.Filter = “(&(objectCategory=person)(objectSid=$($CurrentUserSid)))”
#$Searcher.Filter = “(&(objectCategory=person)(cn=$($CurrentUsername)))”
$Searcher.SearchRoot = “LDAP://$($domain)”
$User = $Searcher.FindOne()
$CurrentUpn = ([ADSI]$User.Path).userPrincipalName
 
If ($(Test-Path -Path “HKCU:\Software\Microsoft\Office\16.0\Lync”) -eq $False) { New-Item “HKCU:\Software\Microsoft\Office\16.0\Lync” }
New-ItemProperty “HKCU:\Software\Microsoft\Office\16.0\Lync” -Name “SavePassword” -Value 1 -PropertyType “DWord” -Force
New-ItemProperty “HKCU:\Software\Microsoft\Office\16.0\Lync” -Name “ServerSipUri” -Value $CurrentUpn -PropertyType “String” -Force
New-ItemProperty “HKCU:\Software\Microsoft\Office\16.0\Lync” -Name “ServerUsername” -Value $CurrentUpn -PropertyType “String” -Force

You may also like...

השאר תגובה