-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwinrmtest_set.ps1
26 lines (25 loc) · 999 Bytes
/
winrmtest_set.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
$answer = $null
Enable-PSRemoting -Force
if ((Get-WmiObject -Class Win32_ComputerSystem).partofdomain -eq $false) {
winrm set winrm/config/service/Auth @{Basic="true"}
write-host "This PC isn't domain joined, so local accounts have been granted authorization to authenticate remotely."
}
else {
write-host "This PC is domain joined. Use an account authorized for remote access."
}
if ((Get-Item WSMan:\localhost\client\Allowunencrypted) -eq $false) {
$answer = Read-Host "Allow unencrypted is currently not enabled. Is connection failing? Y/N"
while("yes","no","y","n" -notcontains $answer)
{
$answer = Read-Host "Allow unencrypted is currently not enabled. Is connection failing? Y/N"
}
if ($answer -eq "yes" -or $answer -eq "y") {
winrm set winrm/config/service @{AllowUnencrypted="true"}
}
else {
write-host "Congratulations!"
}
}
else {
write-host "This computer is already setup to allow unencrypted connections."
}