summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Liddicott <simon+github@liddicott.com>2017-08-07 00:14:56 +0200
committerJordan Borean <jborean93@gmail.com>2017-08-07 00:14:56 +0200
commit3ceeb5124efe286a7273b8136f9793a82da37f84 (patch)
tree350a9adbcccdbed79d51877ea0590f004d2f628f
parentFix asserts of junos_command netconf_json notequal and lessthanorequal (#27818) (diff)
downloadansible-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.ps16
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."
}