Producing an Exception Report
To produce a summary report of the service configuration information you have identified, you must count each service and evaluate its start mode. If the service starts with a user-defined account, you'll need to record that information as well. In the EvaluateServicesAndCount.ps1 script, use the Get-WmiObject cmdlet to retrieve the Win32_Service class and store the resulting object in the $objWMIService variable.
Use the foreach statement and walk through the collection services. Use two switch statements to parse through the object. In the first switch statement, look for startmode. If the startmode is set to auto, you increment the $a counter variable (short for auto) and add its name to the $auto variable used ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access