Fixed error handling for the enabling of PS Remoting

This commit is contained in:
Willem Pienaar 2014-12-16 02:29:13 +02:00
parent 8908f4a0ef
commit ac28652602

View file

@ -98,13 +98,7 @@ ElseIf ((Get-Service "WinRM").Status -ne "Running")
If (!(Get-PSSessionConfiguration -Verbose:$false) -or (!(Get-ChildItem WSMan:\localhost\Listener)))
{
Write-Verbose "Enabling PS Remoting."
Try
{
Enable-PSRemoting -Force -ErrorAction SilentlyContinue
}
Catch
{
}
Enable-PSRemoting -Force -ErrorAction Stop
}
Else
{