Get the App
SLTechnology News&Howtos  ›  Servers  › 

Collect computer information in the domain

Shulou Source: shulou.com Published: 2022-06-02 17:10:00 10月26日 Update

$Date= (Get-Date) .ToString ("yyyyMMdd") Write-Output ("computer name, MAC address, user, Motherboard Model, CPU, physical memory (GB), operating system IP ") | `Out-File-FilePath C:\ LDM-PC$Date.csv-Encoding UTF8 $LDM_PC= (Get-ADComputer-Filter * | Where-Object {$_ .Name-like" lmpc* "- or $_ .Name-like" lmlap* "}) .Name | Sort-ObjectForEach ($PC_Info in $LDM_PC) {IF ((Test-Connection-ComputerName $PC_Info-Count 1-ErrorAction SilentlyContinue). Statuscode-eq 0) {$ComObject=Get-WmiObject-ComputerName $PC_Info -Class Win32_ComputerSystem $Name=$ComObject.Name $UserName=$ComObject.UserName $FullName= (Get-WmiObject Win32_UserAccount | Where-Object {$_ .Caption-eq $UserName}). FullName $Memory= "{0:N0}"-f ($ComObject.TotalPhysicalMemory/1GB) $NetObject=Get-WmiObject-ComputerName $PC_Info-Class Win32_NetWorkAdapterConfiguration-Filter "IPEnabled='True'" $MACAddress=$NetObject.MACAddress-replace ":" "-" $IPAddress=$NetObject.IPAddress-like "*. *" $ProObject=Get-WmiObject-ComputerName $PC_Info-Class Win32_Processor $CPU=$ProObject.Name $OpeObject=Get-WmiObject-ComputerName $PC_Info-Class Win32_OperatingSystem $OpeName=$OpeObject.Caption $BasObject=Get-WmiObject-ComputerName $PC_Info-Class Win32_BaseBoard $BaseModel=$BasObject. Product $SerialNumber=$BasObject.SerialNumber if ($BaseModel-eq "0T1D10") {$BaseModel= "Dell Vostro3800 (large chassis)} # Note the space if ($BaseModel-eq" 0RYP79 ") {$BaseModel=" Dell Vostro 3267 (small chassis)} if ($BaseModel-eq "0JP3NX") {$BaseModel= "Dell OptiPlex 3050 Micro"} if ($BaseModel-eq) "0GG04X") {$BaseModel= "Dell OptiPlex 3050 SFF (large chassis)} if ($BaseModel-eq" B250M-D3H-CF ") {$BaseModel=" gigabyte B250M-D3H-CF "} if ($BaseModel-eq" MS-H110D4L FS M.2 ") {$BaseModel=" inscription MS-H110D4L FS M.2 "} if ($BaseModel-eq" B150M-ET SERIES ") {$BaseModel=" Asustek B150M-ET SERIES "} If ($BaseModel-eq "B85M-F") {$BaseModel= "Asustek B85M-F"} if ($BaseModel-eq "B85M-D2V-SI") {$BaseModel= "gigabyte B85M-D2V-SI"} if ($BaseModel-eq "H81M-DS2") {$BaseModel= "gigabyte H81M-DS2"} if ($BaseModel-eq "C.H81M PRO") {$BaseModel= "seven rainbows C.H81M PRO"} If ($BaseModel-eq "C.B75K") {$BaseModel= "Seven Rainbow C.B75K"} if ($BaseModel-eq "MS-H81IL FS") {$BaseModel= "inscription MS-H81IL FS"} if ($BaseModel-eq "H81M-VG4 R2.0") {$BaseModel= "Ascot H81M-VG4 R2.0"} if ($SerialNumber-eq "/ 4MP1KL2/CNPE10078C05EZ/") {$FullName= "Conference Room 1 "} if ($SerialNumber-eq" / 4MK1KL2/CNPE10078B06OX/ ") {$FullName=" Conference Room 2 "} if ($SerialNumber-eq" / 4MD3KL2/CNPE1007860LI5/ ") {$FullName=" Conference Room 3 "} Write-Output (" `"$Name`") `"$MACAddress`",` "$FullName`", `"$BaseModel`",` "$CPU`", `"$Memory`",` "$OpeName`", `"$IPAddress`") | Out-File-FilePath C:\ LDM-PC$Date.csv-Append-Encoding UTF8}}

Tags: Chassis conference room colorful rainbow Asustek operating system central processing unit motherboard user memory name address model processor physics space system computer Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno vpn Huawei Redmi OPPO Reno Xiaomi