Skip to content

Instantly share code, notes, and snippets.

@fatihtatoglu
Last active April 7, 2021 09:28
Show Gist options
  • Save fatihtatoglu/57815b26532f2e8a5c1917ad3a2b7380 to your computer and use it in GitHub Desktop.
Save fatihtatoglu/57815b26532f2e8a5c1917ad3a2b7380 to your computer and use it in GitHub Desktop.
$url = "https://raw.githubusercontent.com/ansible/ansible/devel/examples/scripts/ConfigureRemotingForAnsible.ps1"
$file = "$env:temp\ConfigureRemotingForAnsible.ps1"
(New-Object -TypeName System.Net.WebClient).DownloadFile($url, $file)
$currentPolicy = Get-ExecutionPolicy -List | Where-Object Scope -eq "LocalMachine" | Select-Object ExecutionPolicy
if ($currentPolicy -ne "Unrestricted") {
Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Force
}
&$file -Verbose
Set-ExecutionPolicy -ExecutionPolicy $currentPolicy
Write-Host "WinRM is configured."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment