Quantcast
Viewing all articles
Browse latest Browse all 21975

How to Set-Timeout for the Cmdlet "Get-Service"

Hi Team,

I am Running an Script for Filling some of our Automation Need, One Part of the Script Code Use the Get-Service Cmdlet to fetch the data  if the necessary Service is installed on the Target Server.

I have Observed on one of the Server randomly the Script Stop to Respond because of this below Code . as it not able to get an output & proceed Further.

"Get-Service -Computername <NetbiosName> -Name HealthService"

Can Somebody help me understand if I want only the above Cmdlet to wait for 2 min for checking the status , how shall I proceed with that in PowerShell.

My Idea is here is check for an service if present then ignore , if not present on the target server then output it to an txt file . which is processed later in the Script.

Regards,

Jason Aranha


Jason Aranha


Viewing all articles
Browse latest Browse all 21975

Trending Articles