0
我是新來的Powershell,我試圖通過電子郵件發送輸出的下面的一段代碼,如果我把它發送到控制檯,它的格式很好,但是當我管道它到電子郵件,檢索到的對象不排隊。在電子郵件排序和格式
$bios = Get-WmiObject Win32_BIOS -ComputerName localhost
$os = Get-WmiObject `Win32_OperatingSystem -ComputerName localhost
$Proc = Get-WmiObject Win32_processor -ComputerName localhost | Select-Object -First 1
$memory = Get-WmiObject Win32_physicalmemory -ComputerName localhost
$system = Get-WmiObject Win32_ComputerSystem -ComputerName localhost
$Systeminfo = New-Object PSObject -Property @{
'ComputerName' = $proc.SystemName;
'Manufacturer' = $bios.Manufacturer;
'Model' = $system.Model;
'BIOS Version' = $bios.Version;
'Serial Number' = $bios.SerialNumber;
'Number of Processors ' = $system.NumberOfProcessors;
'Processor Name' = $proc.name;
'Logical Processor' = $system.NumberOfLogicalProcessors;
'Speed (MHZ)' = $proc.CurrentClockSpeed;
'RAM (GB)' = $system.TotalPhysicalMemory/1GB -as [int];
'Used RAM slots' = $memory.count;
'OSVersion' = $os.Caption
}
$Systeminfo = $Systeminfo | Out-String
此外,有沒有辦法重新安排它們的出現順序,比如,我想計算機名是第一個數組中,但它出現在中間?