mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Set startup type to automatic before attempting to start the service. Otherwise it will fail if the service is disabled. (#27751)
This commit is contained in:
parent
0343ac1a9d
commit
3ceeb5124e
1 changed files with 3 additions and 3 deletions
|
@ -171,12 +171,12 @@ If (!(Get-Service "WinRM"))
|
||||||
}
|
}
|
||||||
ElseIf ((Get-Service "WinRM").Status -ne "Running")
|
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."
|
Write-Verbose "Setting WinRM service to start automatically on boot."
|
||||||
Set-Service -Name "WinRM" -StartupType Automatic
|
Set-Service -Name "WinRM" -StartupType Automatic
|
||||||
Write-Log "Set WinRM service to start automatically on boot."
|
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."
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue