用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
}
}