From 3ceeb5124efe286a7273b8136f9793a82da37f84 Mon Sep 17 00:00:00 2001 From: Simon Liddicott Date: Sun, 6 Aug 2017 23:14:56 +0100 Subject: Set startup type to automatic before attempting to start the service. Otherwise it will fail if the service is disabled. (#27751) --- examples/scripts/ConfigureRemotingForAnsible.ps1 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'examples') 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." } -- cgit v1.2.3