יצוא סריאל ודגם של מחשבים
אם אתם מחפשים להוציא מספר סריאלי (סידורי) ודגם של מחשבים ברשת, ולייצא אותם לקובץ אקסל- המדריך הזה בשבילכם.
תוכן העניינים
מציאת דגם/סריאל מחשב במחשב מקומי
במחשב מקומי ניגש אל חלונית ה-Run ונקליד msinfo32 ואנטר:

התוצאה:
הוצאת דגם/סריאל דרך CMD
למציאת דגם במחשב המקומי פקודת CMD היא:
C:\>wmic csproduct get name Name HP 290 G3 MT Business PC
כדי להציג את המספר הסריאלי במחשב מקומי:
C:\>wmic bios get serialnumber SerialNumber 005223625006
מציאת דגם/סריאל דרך PowerShell
כדי למצוא את הסריאל דרך PS יש להשתמש בפקודה הבאה:
PS C:\> get-ciminstance win32_bios | format-list serialnumber SerialNumber : 005223625006
הצגת סריאל ממחשב מרוחק
כדי להציג את הסריאל ממחשב מרוחק ברשת שלנו (לשנות את davidcomputer אל שם המחשב הרצוי):
PS C:\> Get-WMIObject Win32_Bios -ComputerName davidcomputer | Select-Object SerialNumber SerialNumber ------------ 005223625006
הצגת נתונים נוספים
על מנת להציג את הדגם והסריאל (יחד עם עוד נתונים מעניינים נוספים) של מחשבים אחרים ברשת, יש להשתמש בפקודה הבאה:
$ArrComputers = ".", "davidcomputer", "yakovcomputer" #Specify the list of PC names in the line above. "." means local system Clear-Host foreach ($Computer in $ArrComputers) { $computerSystem = get-wmiobject Win32_ComputerSystem -Computer $Computer $computerBIOS = get-wmiobject Win32_BIOS -Computer $Computer $computerOS = get-wmiobject Win32_OperatingSystem -Computer $Computer $computerCPU = get-wmiobject Win32_Processor -Computer $Computer $computerHDD = Get-WmiObject Win32_LogicalDisk -ComputerName $Computer -Filter drivetype=3 write-host "System Information for: " $computerSystem.Name -BackgroundColor DarkCyan "-------------------------------------------------------" "Manufacturer: " + $computerSystem.Manufacturer "Model: " + $computerSystem.Model "Serial Number: " + $computerBIOS.SerialNumber "CPU: " + $computerCPU.Name "HDD Capacity: " + "{0:N2}" -f ($computerHDD.Size/1GB) + "GB" "HDD Space: " + "{0:P2}" -f ($computerHDD.FreeSpace/$computerHDD.Size) + " Free (" + "{0:N2}" -f ($computerHDD.FreeSpace/1GB) + "GB)" "RAM: " + "{0:N2}" -f ($computerSystem.TotalPhysicalMemory/1GB) + "GB" "Operating System: " + $computerOS.caption + ", Service Pack: " + $computerOS.ServicePackMajorVersion "User logged In: " + $computerSystem.UserName "Last Reboot: " + $computerOS.ConvertToDateTime($computerOS.LastBootUpTime) "" "-------------------------------------------------------" }
התוצאה:
PS C:\> foreach ($Computer in $ArrComputers) >> { >> $computerSystem = get-wmiobject Win32_ComputerSystem -Computer $Computer >> $computerBIOS = get-wmiobject Win32_BIOS -Computer $Computer >> $computerOS = get-wmiobject Win32_OperatingSystem -Computer $Computer >> $computerCPU = get-wmiobject Win32_Processor -Computer $Computer >> $computerHDD = Get-WmiObject Win32_LogicalDisk -ComputerName $Computer -Filter drivetype=3 >> write-host "System Information for: " $computerSystem.Name -BackgroundColor DarkCyan >> "-------------------------------------------------------" >> "Manufacturer: " + $computerSystem.Manufacturer >> "Model: " + $computerSystem.Model >> "Serial Number: " + $computerBIOS.SerialNumber >> "CPU: " + $computerCPU.Name >> "HDD Capacity: " + "{0:N2}" -f ($computerHDD.Size/1GB) + "GB" >> "HDD Space: " + "{0:P2}" -f ($computerHDD.FreeSpace/$computerHDD.Size) + " Free (" + "{0:N2}" -f ($computerHDD.FreeSpace/1GB) + "GB)" >> "RAM: " + "{0:N2}" -f ($computerSystem.TotalPhysicalMemory/1GB) + "GB" >> "Operating System: " + $computerOS.caption + ", Service Pack: " + $computerOS.ServicePackMajorVersion >> "User logged In: " + $computerSystem.UserName >> "Last Reboot: " + $computerOS.ConvertToDateTime($computerOS.LastBootUpTime) >> "" >> "-------------------------------------------------------" >> } System Information for: DavidComputer ------------------------------------------------------- Manufacturer: HP Model: HP 290 G3 MT Business PC Serial Number: 005223625006 CPU: Intel(R) Core(TM) i5-9500 CPU @ 3.00GHz HDD Capacity: 237.87GB HDD Space: 2.36% Free (5.62GB) RAM: 15.86GB Operating System: Microsoft Windows 10 Pro, Service Pack: 0 User logged In: KD\david Last Reboot: 10/10/2020 16:08:50 ------------------------------------------------------- System Information for: YakovComputer ------------------------------------------------------- Manufacturer: HP Model: HP 250 G1 Serial Number: 023FFF103 CPU: Intel(R) Core(TM) i3-6200 CPU @ 3.00GHz HDD Capacity: 244.25GB HDD Space: 5.36% Free (8.32GB) RAM: 8.22GB Operating System: Microsoft Windows 10 Pro, Service Pack: 0 User logged In: KD\user2 Last Reboot: 10/08/2020 13:02:00 ------------------------------------------------------- PS C:\>
ייצוא הנתונים לקובץ CSV
כדי לייצא את הנתונים לקובץ CSV מסודר יש להשתמש בפקודה הבאה:
Get-Content c:\list.txt | foreach { $computerSystem = Get-WmiObject Win32_ComputerSystem -Computer $_ $computerBIOS = Get-WmiObject Win32_BIOS -Computer $_ $computerOS = Get-WmiObject Win32_OperatingSystem -Computer $_ $computerCPU = Get-WmiObject Win32_Processor -Computer $_ $computerHDD = Get-WmiObject Win32_LogicalDisk -ComputerName $_ -Filter drivetype=3 New-Object PSObject -Property @{ "Manufacturer" = $computerSystem.Manufacturer "Model" = $computerSystem.Model "Serial Number" = $computerBIOS.SerialNumber "CPU" = $computerCPU.Name "HDD Capacity" = ("{0:N2}" -f ($($computerHDD|measure Size -sum).Sum/1GB) + "GB") "HDD Space" = ("{0:P2}" -f ($($computerHDD|measure FreeSpace -sum).Sum/$($computerHDD|measure Size -sum).Sum) + " Free (" + "{0:N2}" -f ($($computerHDD|measure FreeSpace -sum).Sum/1GB) + "GB)") "RAM" = ("{0:N2}" -f ($computerSystem.TotalPhysicalMemory/1GB) + "GB") "Operating System" = ($computerOS.caption + ", Service Pack: " + $computerOS.ServicePackMajorVersion) "User logged In" = $computerSystem.UserName "Last Reboot" = $computerOS.ConvertToDateTime($computerOS.LastBootUpTime) } } | Export-Csv c:\temp\list.csv -NoTypeInformation
התוצאה: