我创建了一个脚本来帮助我们清点我们的机器。它是成功的,最后我创建了一个表并将该对象导出到 CSV。
大量机器有时不返回任何值(RPC 服务不可用)。我将如何检查是否返回了每个值?如果没有打开任何值,我想将这些机器添加到单独的列表中以进行故障排除。什么是最有效的检查方式?
$table = @{
Model= $PCInfo.Model
IEVersion = $ie.sValue
Serial = $Bios.SerialNumber
Memory = $ram
Department = $dp.Department
DriveFreeSpaceGB = $freespace
Manufacturer = $PCInfo.Manufacturer
OSName = $WinInfo.Caption
Computer = $computer
Uptime = $formattime
LastloggedinUser = $Uname.name
LastLoggedinDate = $loggedintime
LoggedOnDuringScan = $PCInfo.Username
ServicePack = $WinInfo.ServicePackMajorVersion
Online = $Online
}
New-Object PSObject -Property $table | Export-Csv C:\logs\ADInventory\ADInventory.csv -NoTypeInformation -Append
}