![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | -f format Format-Table Format-List against Select For some reason I need to rename a column within a select Get-WmiObject win32_SystemEnclosure -ComputerName SD-IT003 it returns SerialNumber But I do not like this label, I want to rename it so Get-WmiObject win32_SystemEnclosure -ComputerName $p | ft @{Expression= {$_.SerialNumber};Label="SN"} --> This works really well, but instead of renaming the column in FT, I need to rename it during a select So I tried this: Get-WmiObject win32_SystemEnclosure -ComputerName $p | select @ {Expression={$_.SerialNumber};Label="SN"} | ft * but it returns Select-Object : Illegal key Label At line:1 char:61 + Get-WmiObject win32_SystemEnclosure -ComputerName $p| select <<<< @ {Expression={$_.SerialNumber};Label="SN"} Why is that ? is there a way to fix it ? |
My System Specs![]() |
| | #2 (permalink) |
| | Re: -f format Format-Table Format-List against Select My goal is to do this $p=get-qadcomputer -name sd-* $p | foreach { gwmi win32_operatingsystem -ComputerName $_.name | select CSName,caption,CSDVersion,version,Description,SerialNumber #gwmi Win32_WindowsProductActivation -ComputerName $_.name | select ProductID gwmi Win32_ComputerSystem -ComputerName $_.name | select Domain,Manufacturer,Model,UserName gwmi win32_bios -ComputerName $_.name | select SerialNumber gwmi win32_SystemEnclosure -ComputerName $_.name | select SerialNumber } | ft * but as you can see I do have 3 requests returning a Serialnumber, but I would like to return a table with SN1,SN2 and SN3 |
My System Specs![]() |
| | #3 (permalink) |
| | Re: -f format Format-Table Format-List against Select Personne wrote: Quote: > --> This works really well, but instead of renaming the column in FT, > I need to rename it during a select > > So I tried this: > > Get-WmiObject win32_SystemEnclosure -ComputerName $p | select @ > {Expression={$_.SerialNumber};Label="SN"} | ft * long time with the logic of this and eventually squared it with my brain by referring to the fields created by Select-Object as "real properties" and properties have names, as opposed to Format-* which is merely for display purposes, so "label" implies a more temporary connotation. HTH -- $signature = "Hal Rottenberg, MVP - Admin Frameworks" $projects = @{ title = "Blog Author"; url = "http://halr9000.com" }, @{ title = "Co-host"; url = "http://powerscripting.net" }, @{ title = "Community Director"; url = "http://PowerShellCommunity.org" }, @{ title = "Psi Webmaster"; url = "http://psi-im.org" } |
My System Specs![]() |
| | #4 (permalink) |
| | Re: -f format Format-Table Format-List against Select $p="." $with_label = @{Expression={$_.SerialNumber};Label="SN1"} $with_name = @{Expression={$_.SerialNumber};Name="SN2"} gwmi win32_SystemEnclosure -ComputerName $p | ft $with_label gwmi win32_SystemEnclosure -ComputerName $p | select $with_name Works Perfect Thank you |
My System Specs![]() |
| | #5 (permalink) |
| | Re: -f format Format-Table Format-List against Select On Nov 24, 1:01*pm, Personne <cpdiv...@xxxxxx> wrote: Quote: > $p="." > $with_label = @{Expression={$_.SerialNumber};Label="SN1"} > $with_name = @{Expression={$_.SerialNumber};Name="SN2"} > > gwmi win32_SystemEnclosure -ComputerName $p | ft $with_label > gwmi win32_SystemEnclosure -ComputerName $p | select $with_name > > Works Perfect > Thank you for HP and IBM's you have to look in Win32_BIOS for the SerialNumber or Win32_ComputerSystemProduct for the IdentifyingNumber 1# gwmi Win32_ComputerSystemProduct IdentifyingNumber : MXL60207Q5 Name : HP Compaq dc7600 Small Form Factor Vendor : Hewlett-Packard Version : Caption : Computer System Product 2# gwmi Win32_BIOS SMBIOSBIOSVersion : 786D1 v01.03 Manufacturer : Hewlett-Packard Name : Default System BIOS SerialNumber : MXL60207Q5 Version : COMPAQ - 20050518 OldDog |
My System Specs![]() |
| | #6 (permalink) |
| | Re: -f format Format-Table Format-List against Select On Nov 24, 1:01*pm, Personne <cpdiv...@xxxxxx> wrote: Quote: > $p="." > $with_label = @{Expression={$_.SerialNumber};Label="SN1"} > $with_name = @{Expression={$_.SerialNumber};Name="SN2"} > > gwmi win32_SystemEnclosure -ComputerName $p | ft $with_label > gwmi win32_SystemEnclosure -ComputerName $p | select $with_name > > Works Perfect > Thank you HP servers will give you the serial number in three different places; gwmi Win32_BIOS -computername server1 as SerialNumber Or gwmi Win32_ComputerSystemProduct -computername Server1 as IdentifyingNumber as well as gwmi win32_SystemEnclosure -computername Server1 as SerialNumber OldDog |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Windows Mail format bar doesn't format color, size, justification | Browsers & Mail | |||
| RE: How to convert Table-Format Data to CSV-Format? | PowerShell | |||
| RE: How to convert Table-Format Data to CSV-Format? | PowerShell | |||
| RE: How to convert Table-Format Data to CSV-Format? | PowerShell | |||
| Help! DVD format error: "Windows was unable to complete the format | Vista General | |||