如何使用单个 PowerShell 脚本获取 Get-VM 和 Get-VMNetworkAdapter 属性的 CSV 输出?

问题描述

Expected Output Image 我刚开始编码,并坚持在脚本之上构建 PowerShell。 如何编写单个脚本来执行具有指定属性的 Get-VM 和 Get-VMNetworkAdapter。尝试从 Hyper-V 主机或 Windows 服务器获取 VM 信息。 输出:应该是单个 csv 文件

PS C:\User> Get-VM -Name * | Select-Object -Property Name,State,cpuUsage,Status | Export-Csv -Path E:\MYfolder/report.csv -NoTypeinformation              #giving csv expected results alone
PS C:\User> Get-VMNetworkAdapter -Name * | Select-Object -Property MacAddress,IPAddresses | Export-Csv -Path E:\MYfolder/report.csv -NoTypeinformation         #giving csv expected results alone

谢谢!

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)