Remove a Windows feature from a running installation and use the return code for further action.
1 2 3 4 5 6 7 8 |
Import-Module ServerManager $status = Remove-WindowsFeature Server-Media-Foundation if ($status.Success -eq $true) {if ($status.RestartNeeded -eq "Yes") {$exitCode=3010}} else {$exitCode=-1} [Environment]::Exit($exitCode) |