Get-ComputerInfo | # by default, columns are named "Property" and "Value" ConvertObject-ToHashTable | Out-GridView
Get-WmiObject-Class Win32_BIOS | # specify how you'd like to call the columns displayed in a grid view window ConvertObject-ToHashTable-PropertyName Information -ValueNameData | Out-GridView
# create a hash table where the key is the selected properties to display, # and the value is the original object $hashTable = Get-WmiObject-Class Win32_NetworkAdapterConfiguration | # sort the objects by a property of your choice Sort-Object-Property Description | # use an ordered hash table to keep sort order # (requires PowerShell 3; for older PowerShell remove [Ordered]) ForEach-Object { $ht = [Ordered]@{}}{ # specify the properties that you would like to show in a grid view window $key = $_ | Select-Object-Property Description, IPAddress, MacAddress $ht.Add($key, $_) }{$ht} Group-Object-Property Description, Index -AsHashTable-AsString
# show the keys in the grid view window $hashTable.Keys | Out-GridView-Title"Select Network Card"-OutputMode Single | ForEach-Object { # and retrieve the original (full) object by using # the selected item as key into your hash table $selectedObject = $hashTable[$_] $selectedObject | Select-Object-Property * }
Get-WmiObject-ClassName Win32_UserProfile -Filter"Special=False AND Loaded=False" | Add-Member-MemberType ScriptProperty -Name UserName -Value { (New-Object System.Security.Principal.SecurityIdentifier($this.Sid)).Translate([System.Security.Principal.NTAccount]).Value } -PassThru | Out-GridView-Title"Select User Profile"-OutputMode Single | ForEach-Object { # uncomment the line below to actually remove the selected user profile! #$_.Delete() }
$hashTable.Keys | Sort-Object | Out-GridView-Title"Select User Profile"-OutputMode Single | ForEach-Object { # uncomment the line below to actually remove the selected user profile! # $hashTable[$_].Delete()