На ПоШе. Нужен Excel.
#########################################################################################
##
## Скрипт для сбора данных по 1 ПК. Оформляем как функцию (или направляем в конвейер), если надо для списка ПК.
##
#########################################################################################
$StrComputer = $env:COMPUTERNAME # --- меняем на требуемый ПК, сейчас берет локальный.
$Excel = New-Object -Com Excel.Application
$Excel.visible = $True
$Excel = $Excel.Workbooks.Add()
$Sheet1 = $Excel.Worksheets.Item(1)
$Sheet1.Name = "Inventory"
$Sheet1.Cells.Item(1,1) = "Имя"
$Sheet1.Cells.Item(1,2) = "Модель ПК"
$Sheet1.Cells.Item(1,4) = "Тип"
$Sheet1.Cells.Item(1,5) = "ЦПУ"
$Sheet1.Cells.Item(1,8) = "ОЗУ,GB"
$Sheet1.Cells.Item(1,6) = "Оп.система"
$Sheet1.Cells.Item(1,7) = "SP ОС"
$Sheet1.Cells.Item(1,3) = "Серийный №"
$Sheet1.Cells.Item(1,9) = "Диск(реал.),GB"
$Sheet1.Cells.Item(1,10) = "Диск(произ.),GB"
$colSheets = ($Sheet1)
foreach ($colorItem in $colSheets){
$WorkBook = $colorItem.UsedRange
$WorkBook.Interior.ColorIndex = 20
$WorkBook.Font.ColorIndex = 11
$WorkBook.Font.Bold = $True
}
#====================================================================================================
$intRow = 2
if ((Test-connection $StrComputer -count 2 -quiet) -eq "True")
{
$GenItems1 = gwmi Win32_ComputerSystem -Comp $StrComputer
$GenItems2 = gwmi Win32_OperatingSystem -Comp $StrComputer
$CPUItems = gwmi Win32_Processor -Comp $StrComputer
$SysItems1 = gwmi Win32_BIOS -Comp $StrComputer
$ProcItems1 = gwmi Win32_Processor -Comp $StrComputer
$DiskItems = gwmi Win32_LogicalDisk -Comp $StrComputer
$PhisDisk = gwmi Win32_DiskDrive -Comp $StrComputer
foreach ($objItem in $GenItems1)
{ $Sheet1.Cells.Item($intRow, 1) = $StrComputer
$Sheet1.Cells.Item($intRow, 2) = $objItem.Model
$Sheet1.Cells.Item($intRow, 4) = ($objItem.SystemType -replace "-based PC","")
$Sheet1.Cells.Item($intRow, 8) = [math]::Round(($objItem.TotalPhysicalMemory / 1024 / 1024 / 1024),2)
}
$Sheet1.Cells.Item($intRow, 5) = $CPUItems.Name
foreach ($objItem in $GenItems2)
{ $aa = ($objItem.Caption -replace "Microsoft Windows","MS Win")
$aa = ($aa -replace "Профессиональная","Проф.")
$aa = ($aa -replace "Professional","Проф.")
$aa = ($aa -replace "Корпоративная","Корп.")
$aa = ($aa -replace "Майкрософт Windows","MS Win")
$aa = ($aa -replace "(Registered Trademark)","")
$Sheet1.Cells.Item($intRow, 6) = $aa
$Sheet1.Cells.Item($intRow, 7) = ($objItem.csdversion -replace "Service Pack","SP")
}
foreach ($objItem in $SysItems1)
{
if( $objItem.SerialNumber -eq "System Serial Number") {$Sheet1.Cells.Item($intRow, 3) = "Самосборка"} else {$Sheet1.Cells.Item($intRow, 3) = $objItem.SerialNumber}
if( $objItem.SerialNumber -match "Parallels*" -or $objItem.SerialNumber -match "VMware*") {$Sheet1.Cells.Item($intRow, 3) = "VM"}
}
foreach ($objItem in $PhisDisk)
{
if( $objItem.Model -notmatch 'usb' )
{
$Sheet1.Cells.Item($intRow, 9) = [math]::Round(($objItem.Size/1024/1024/1024),2)
$Sheet1.Cells.Item($intRow, 10) = [math]::Round(($objItem.Size/1000/1000/1000),0)
}
}
$intRow += 1
}
else {" IP = "+$StrComputer + "--- не доступен."}
#====================================================================================================
foreach ($colorItem in $colSheets)
{
$WorkBook = $colorItem.UsedRange
$WorkBook.EntireColumn.AutoFit()
}
Удачи!