Solved

Show computer name with Get-WmiObject win32_service

Posted on 2010-11-24
3
2,422 Views
Last Modified: 2012-05-10
Using PowerShell, I am trying to get a list of multiple computers' services with their computername, name, state, and startmode.

Essentially, I am looking to have a nicely formatted list of services with the computer name, service name, startup type, and current state. I am able to get a list of the services from multiple machines, but cannot get the computer name outputted.  Here is what I am working with, but in this case obviously the ComputerName column is blank:

Get-WmiObject win32_service -computername server1, server2, server3 | sort -property StartMode | format-table ComputerName, Name, StartMode, State -autosize

If I use Get-Service in a similar fashion as above, I am able to pull the computer/machine name, but then I am unable to pull the Startup type.

Any clues?
Get-WmiObject win32_service -computername server1, server2, server3 | sort -property StartMode | format-table ComputerName, Name, StartMode, State -autosize

ComputerName Name                                StartMode State
------------ ----                                --------- -----
             CryptSvc                            Auto      Running
             clr_optimization_v4.0.30319_64      Auto      Stopped


^It would be nice to see something like:

ComputerName Name                                StartMode State
------------ ----                                --------- -----
Server1      CryptSvc                            Auto      Running
Server2      clr_optimization_v4.0.30319_64      Auto      Stopped

Open in new window

0
Comment
Question by:CecilAdmin
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 27

Accepted Solution

by:
KenMcF earned 500 total points
ID: 34206442
Instead of computername use __Server

There are two "_"
0
 

Author Comment

by:CecilAdmin
ID: 34206467
^Beast...

Is there a list of these variables around?
0
 
LVL 27

Expert Comment

by:KenMcF
ID: 34206543
The best thing to do is use the get-member or list all. Here is an example with pulling a single service so you do not get to much data back

gwmi win32_service | Where{$_.name -eq "Win32Time"} | FL *

gwmi win32_service | Where{$_.name -eq "Win32Time"} | get-member
0

Featured Post

Edgartown IT Case Study

Learn about Edgartown's quest to ensure the safety and security of the entire town's employee and citizen data. Read the case study!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The following article is intended as a guide to using PowerShell as a more versatile and reliable form of application detection in SCCM.
A quick Powershell script I wrote to find old program installations and check versions of a specific file across the network.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question