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

Hash Table

$
0
0

Heres my hash Table

$h = [ordered]@{
Computername=$env:computername
ServiceState = "wscsvc", "CcmExec" | foreach {Get-WmiObject -Class Win32_Service -Filter "Name = '$($_)'" | select Name, State }
ServiceStartUp = "wscsvc", "CcmExec" | foreach {Get-WmiObject -Class Win32_Service -Filter "Name = '$($_)'" | select Name, StartMode}
 
}
 
[pscustomobject]$h
 
$h | select -expandproperty values
 
# I  get this
 
Name                           Value                                                                        
—-                           —–                                                                        
Computername                   BR-ADMIN3                                                                    
ServiceState                   {@{Name=wscsvc; State=Running}, @{Name=CcmExec; State=Running}}              
ServiceStartUp                 {@{Name=wscsvc; StartMode=Auto}, @{Name=CcmExec; StartMode=Auto}}

how do i remove the {@{

thank you


Viewing all articles
Browse latest Browse all 13067

Trending Articles