Alias a Property Name In Powershell 3

后端 未结 3 637
北恋
北恋 2021-01-03 22:16

Using the example below:

Get-Service | ConvertTo-HTML -Property Name, Status > C:\\services.htm

I was wondering if it is possible to ali

3条回答
  •  离开以前
    2021-01-03 22:59

    You could do an intermediate step of creating objects with the property names you want using the new-object cmdlet.

    Get-Service | foreach{ new-object PSObject -property @{newname=($_.Name); newstatus=($_.Status)}} | ConvertTo-Html > .\services.htm
    

提交回复
热议问题