判断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
}
}