Powershell - Change Output Object Property Names
Quote from HeelpBook on October 18, 2018, 2:40 pmHow to change the "Label" or "Name" of a property selected by using Select or Select-Object in Powershell?
How to change the "Label" or "Name" of a property selected by using Select or Select-Object in Powershell?
Quote from HeelpBook on October 18, 2018, 2:43 pmLet's say we want to get some info from WMI our computer name by using Powershell: the easiest way to achieve this is to use Select-Object and a calculated field:
Get-WmiObject -Class win32_OperatingSystem -ComputerName webr201 | Select-Object @{N='ComputerName'; E={$_.PSComputerName}} In this way we will be able to rename the selected label/name by using, as we said above, a calculated field (in which, however, we did not calculate anything).
Let's say we want to get some info from WMI our computer name by using Powershell: the easiest way to achieve this is to use Select-Object and a calculated field:
Get-WmiObject -Class win32_OperatingSystem -ComputerName webr201 | Select-Object @{N='ComputerName'; E={$_.PSComputerName}} |
In this way we will be able to rename the selected label/name by using, as we said above, a calculated field (in which, however, we did not calculate anything).