Quantcast
Channel: PowerShell.org » All Posts
Viewing all articles
Browse latest Browse all 13067

Reply To: Hash Table

$
0
0

I'm not sure what you're doing with that hashtable. Here's a different approach which builds an array of objects, which are displayed in a more user-friendly way by Format-Table:

$services = "wscsvc", "CcmExec" | foreach {
    Get-WmiObject -Class Win32_Service -Filter "Name = '$($_)'" |
    select  @{Name = 'ComputerName'; Expression = { $env:computername }}, Name, State, StartMode
}
 
$services | Format-Table -AutoSize

Viewing all articles
Browse latest Browse all 13067

Trending Articles