This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Supports Windows 2012 R2 and up. Ensure you have Local Administrator access and network connectivity to the target servers for whatever account runs this. | |
Function ConfirmState | |
{ | |
param($confirm_feature,$truetext,$falsetext) | |
if($truetext -eq $null){$truetext = "$confirm_feature was successfully installed!"} | |
if($falsetext -eq $null){$falsetext = "ERROR!!! $confirm_feature was NOT INSTALLED!"} | |
$installstate = Get-WindowsOptionalFeature -Online -FeatureName $confirm_feature | |
if($installstate.state -Like "Enabled"){$truetext| %{ Write-Host -foreground "green" $_; $_ } | Out-File $log_file -Append}else{$falsetext | %{ Write-Host -foreground "red" $_; $_ } | Out-File $log_file -Append} | |
} |