Примеры задания настроек брандмауэра
Включение удаленного администрирования
$errRTN=netsh firewall set service remoteAdmin enable
if($errRTN -match 'ok')
{ Write-Host -ForegroundColor green "Remote admin enabled" }
ELSEIF($errRTN -match 'requires elevation')
{ Write-Host -ForegroundColor red "Remote admin not enabled" `
"The operation requries admin rights"}
ELSE
{ Write-Host -ForegroundColor red "Remote admin not enabled" `
"The error reported was $errRTN" }
Включение общих папок
$errRTN=netsh firewall set service fileAndPrint enable
if($errRTN -match 'ok')
{ Write-Host -ForegroundColor green "Shared folders enabled" }
ELSEIF($errRTN -match 'requires elevation')
{ Write-Host -ForegroundColor red "Shared folders not enabled" `
"The operation requries admin rights"}
ELSE
{ Write-Host -ForegroundColor red "Shared folders not enabled" `
"The error reported was $errRTN" }
Голосов пока нет

Оставить комментарий