Quantcast
Channel: PowerShell
Viewing all articles
Browse latest Browse all 15370

automatic Services

$
0
0

Hi Team,

I created script to check the service with set to automatic  by default and all running.

but i tried to stopped one of the service and verify.

and when i run my script it show " "All Auto Services are running!Yes"

and it doesn't display the servicename with stopped status.

see below my script if there is need to add:(

Text
$serviceauto=Get-WmiObject win32_service | 
Where-Object {$_.Startmode -eq "Auto"}|select Name,Startmode,State

if (!($serviceauto.state -eq "Running"))

{write-host "Please check $serviceauto.name"
}
else
{ write-host 

 "All Auto Services are running!Yes
}

Thanks


Viewing all articles
Browse latest Browse all 15370

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>