Solved

Show computer name with Get-WmiObject win32_service

Posted on 2010-11-24
3
2,319 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

Free Webinar: AWS Backup & DR

Join our upcoming webinar with experts from AWS, CloudBerry Lab, and the Town of Edgartown IT to discuss best practices for simplifying online backup management and cutting costs.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Need help Creating PowerShell Script 4 45
Combining Get-Mailbox and Get-MailboxStatistics in PowerShell 3 51
Powershell Code 4 31
-OutVariable to Global 1 22
Utilizing an array to gracefully append to a list of EmailAddresses
I thought I'd write this up for anyone who has a request to create an anonymous whistle-blower-type submission form created using SharePoint 2010 (this would probably work the same for 2013). It's not 100% fool-proof but it's as close as you can get…
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…

733 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