Solved

Show computer name with Get-WmiObject win32_service

Posted on 2010-11-24
3
2,124 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
  • 2
3 Comments
 
LVL 27

Accepted Solution

by:
KenMcF earned 500 total points
Comment Utility
Instead of computername use __Server

There are two "_"
0
 

Author Comment

by:CecilAdmin
Comment Utility
^Beast...

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

Expert Comment

by:KenMcF
Comment Utility
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Are you one of those front-line IT Service Desk staff fielding calls, replying to emails, all-the-while working to resolve end-user technological nightmares? I am! That's why I have put together this brief overview of tools and techniques I use in o…
This script checks a path to see if a folder exists. If the folder does exist you will get output "The folder has previously been created. No action taken" If not it will create the folder. Then adds one user modify permission to the folder. It …
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

762 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now