PowerShell "select as" 变量函数

PowerShell "select as" function on variable

这只是一个关于 PowerShell 语法别名问题的简单问题。但是我找不到与它相关的ATM 解决方案。

Select SystemName , DeviceID, 

根据上面的说法,我想显示

"DeviceID" as "drives"

"SystemName" as "server"

参考的完整 PowerShell 脚本:

$diskvalue += Get-WmiObject @Params | Select SystemName , DeviceID, @{Name=”size(MB)”;Expression={“{0:N1}” -f($_.size/1mb)}}, @{Name=”freespace(MB)”;Expression={“{0:N1}” -f($_.freespace/1mb)}}, @{Name=”UsedSpace(MB)”;Expression={“{0:N2}” -f(($_.size - $_.FreeSpace)/1mb)}}
    $diskvalue | Export-Csv C:\example.csv -NoTypeInformation
select @{l='drives';e='DeviceID'}, @{l='server';e='SystemName'}