W2KSG: Service Information

We can use get-service to retrieve information regarding the services installed on a system. It doesn’t return all of the information we might want – specifically it doesn’t return the starting mode of the service.  We can get this with WMI

Script Center Home > Microsoft Windows 2000 Scripting Guide > Scripting Concepts and Technologies for System Administration > WMI Scripting Primer  Common Information Model

Listing 6.6

Get-WmiObject -Class win32_service | Select Name, DisplayName, Description, PathName, StartMode, State

Get the Win32_Service class information using Get-WMIObject.  Remember that we can access this information on remote computers by adding -computername name_of_machine. We then use a select to pick out the specific data we are interested in.  We could use -property instead of a select but it returns the WMI specific information that we don’t really need.

__GENUS          : 2
__CLASS          : Win32_Service
__SUPERCLASS     :
__DYNASTY        :
__RELPATH        : Win32_Service.Name="XobniService"
__PROPERTY_COUNT : 2
__DERIVATION     : {}
__SERVER         :
__NAMESPACE      :
__PATH           :
Name             : XobniService
StartMode        : Auto
Scope            : System.Management.ManagementScope
Path             : Win32_Service.Name="XobniService"
Options          : System.Management.ObjectGetOptions
ClassPath        : Win32_Service
Properties       : {Name, StartMode}
SystemProperties : {__GENUS, __CLASS, __SUPERCLASS, __DYNASTY…}
Qualifiers       : {dynamic, Locale, provider, UUID}
Site             :
Container        :

In this case using Select gives us more control

 


Share this post :

 

Technorati Tags: ,,

About these ads
This entry was posted in PowerShell and WMI. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s