top of page

PowerShell Hash Tables

#Set Values to Variable         
    $Hotfix = Get-Hotfix | Select -ExpandProperty HotfixID

    $Services = Get-Service | Where {$_.Status -eq "Running"} | Select -ExpandProperty Name

    $Enabled_Local_Accounts=Get-WmiObject -Class Win32_UserAccount -Filter {LocalAccount ='True' and Disabled='False'} | Select -ExpandProperty Name

    $Drives=Get-PSDrive | Where{$_.Free -ne $Null} | Select -ExpandProperty Name 
    
 
#Creatre Hash and add Multiple Values 
    $MyHASH=@{
        Running_Services=$Services;
        Installed_Hotfix=$Hotfix;
        Enabled_Local_accounts=$Enabled_Local_Accounts
        Hard_Drives=$Drives
    }    

    #Access Hash Data    
    $MyHASH.Installed_Hotfix

HashMe.PNG
bottom of page