diff options
author | Simon Liddicott <simon+github@liddicott.com> | 2017-08-07 00:14:56 +0200 |
---|---|---|
committer | Jordan Borean <jborean93@gmail.com> | 2017-08-07 00:14:56 +0200 |
commit | 3ceeb5124efe286a7273b8136f9793a82da37f84 (patch) | |
tree | 350a9adbcccdbed79d51877ea0590f004d2f628f | |
parent | Fix asserts of junos_command netconf_json notequal and lessthanorequal (#27818) (diff) | |
download | ansible-3ceeb5124efe286a7273b8136f9793a82da37f84.tar.xz ansible-3ceeb5124efe286a7273b8136f9793a82da37f84.zip |
Set startup type to automatic before attempting to start the service. Otherwise it will fail if the service is disabled. (#27751)
-rw-r--r-- | examples/scripts/ConfigureRemotingForAnsible.ps1 | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/examples/scripts/ConfigureRemotingForAnsible.ps1 b/examples/scripts/ConfigureRemotingForAnsible.ps1 index b84dc295a4..3b2ddcd512 100644 --- a/examples/scripts/ConfigureRemotingForAnsible.ps1 +++ b/examples/scripts/ConfigureRemotingForAnsible.ps1 @@ -171,12 +171,12 @@ If (!(Get-Service "WinRM")) } ElseIf ((Get-Service "WinRM").Status -ne "Running") { - Write-Verbose "Starting WinRM service." - Start-Service -Name "WinRM" -ErrorAction Stop - Write-Log "Started WinRM service." Write-Verbose "Setting WinRM service to start automatically on boot." Set-Service -Name "WinRM" -StartupType Automatic Write-Log "Set WinRM service to start automatically on boot." + Write-Verbose "Starting WinRM service." + Start-Service -Name "WinRM" -ErrorAction Stop + Write-Log "Started WinRM service." } |