diff options
author | Simon Liddicott <simon+github@liddicott.com> | 2017-08-06 23:14:56 +0100 |
---|---|---|
committer | Jordan Borean <jborean93@gmail.com> | 2017-08-07 08:14:56 +1000 |
commit | 3ceeb5124efe286a7273b8136f9793a82da37f84 (patch) | |
tree | 350a9adbcccdbed79d51877ea0590f004d2f628f /examples/scripts | |
parent | 0343ac1a9d60ed8de9b4ff967ab0674a5ff673e7 (diff) | |
download | ansible-3ceeb5124efe286a7273b8136f9793a82da37f84.tar.gz |
Set startup type to automatic before attempting to start the service. Otherwise it will fail if the service is disabled. (#27751)
Diffstat (limited to 'examples/scripts')
-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." } |