判断Server Manager里面的Role是否已经安排

用InstallState来判断

function Check-DataDeduplication
{
 Import-Module "ServerManager" -ErrorAction SilentlyContinue
 if((Get-Module "ServerManager") -and (Get-WindowsFeature -name FS-Data-Deduplication -ErrorAction SilentlyContinue))
 {
  $scriptenv.IsExistDataDeduplicationEnv = (Get-WindowsFeature -name FS-Data-Deduplication).InstallState -eq [Microsoft.Windows.ServerManager.Commands.InstallState]::Installed
 }
}

posted @ 2013-11-21 17:32  Binyao  阅读(308)  评论(0编辑  收藏  举报