My Technical Notes

Saturday, 18 March 2017

PowerShell: Get a Service's Description

The result of `Get-Service` is a set of `System.ServiceProcess.ServiceController` objects, a type which does not have a property for the description shown in the Windows Services Window. The below sample code shows how to get the description for of the `XboxNetApiSvc` service.

& {
    $svc = [System.Management.ManagementObject]::new("Win32_Service.Name='XboxNetApiSvc'")

In order to get the description for a `ServiceController` object, pass in the object's `Name` property in place of `XboxNetApiSvc`.

No comments: