Lync/Skype服务器常用Powershell命令汇总
原创
©著作权归作者所有:来自51CTO博客作者莫让治昂的原创作品,请联系作者获取转载授权,否则将追究法律责任
- 查看用户路由组信息
Get-CsUser
sip:user@contoso.com | %{$strRoutingGroup =
$_.UserRoutingGroupID.ToString() -replace "-","";Write-Host
$strRoutingGroup}
- 查看前端服务器承载的所有路由组
Get-CsPoolFabricState -PoolFqdn skypepool.contoso.com -Type routing -Verbose
- 查看UpgradeDomain信息
(Get-CsPoolUpgradeReadinessState).upgradedomains
- 查看用户SIP以及SMTP地址
Get-CsUser user | select -ExpandProperty proxyaddresses
- 循环浏览所有启用Lync的用户,并查看他们的代理地址中是否有SIP值
$i=0;Get-CSUser
| %{ $strSam=$_.SamAccountName; $strSip=$_.SipAddress; $strName=$_.Name;$i++;
If
((get-aduser -identity $strSam -properties proxyaddresses | select
proxyaddresses -ExpandProperty proxyaddresses | where {$_ -match
"sip:"}).Count -ne 1) {
Write-host
"WARNING: $i - $strSam - $strName - $strSip" -foregroundcolor DarkRed
}
}
- 查找AD中未启用Lync的用户
Get-CSUser -filter
{enabled -eq $false} | %{$strSam=$_.SamAccountName;Get-ADuser -filter
{SamAccountName -eq $strSam} | where {$_.Enabled -ne $false}}
- 检查ProxyAddresses属性中没有sip项的用户
$i=0;Get-CSUser
| %{ $strSam=$_.SamAccountName; $strSip=$_.SipAddress; $strName=$_.Name;$i++;
If
((get-aduser -identity $strSam -properties proxyaddresses | select
proxyaddresses -ExpandProperty proxyaddresses | where {$_ -match
"sip:"}).Count -ne 1) {
Write-host
"WARNING: $i - $strSam - $strName - $strSip" -foregroundcolor DarkRed
}
}
- 检查是否使用了5061、443或3478端口,然后记录到test.log
while
($true){netstat -ano | findstr "5061 443 3478"|tee -a test.log;sleep
5;cls}
- 检查安装的Lync/Skype服务器版本
Get-WmiObject -query 'select * from win32_product' | where {$_.name
-like "Microsoft Lync Server*" -or $_.name -like "Skype for
Business*"}
- 在AD中查找名称类似Lync的所有服务器,然后列出开启了data collector名为“Lync性能监视”的服务器。
Get-ADComputer
-filter {name -like "*lync*"} | %{ $strServer
=$_.DNSHostName;write-host $strServer;$intCount=(logman -s $strServer|where {$_
-match "Lync Performance Monitoring"}).Count;($intCount -eq 1)}