rafka
19-11-2024, 10:24
Добрый день !
код слишком длинный и поэтому не мог полностью кидать сюда.
Вопрос такого характера что кто может добавить код после `r`n$(addSp "Manufacturer" 15) : $model" что бы после модель компьютера показывал и Серийник ? Прошу очень помочь
function CompHw {
if (-not $ip){return}
$hst= ((get-wmiobject -list "StdRegProv" -computername $compAdr -namespace root\default).GetStringValue(2147483650,"SOFTWARE\Microsoft\Virtual Machine\Guest\Parameters","HostName")).sValue
$memSum=0; $model=""; $memModule=""
$cpu=(Get-WmiObject -Class CIM_Processor -ComputerName $compAdr).Name | Select-Object -first 1
$cpu=$cpu -replace ' ',' '; $cpu=$cpu -replace ' ',' '; $cpu=$cpu -replace ' ',' ' ;$cpu=$cpu -replace ' ',' '
$cpu=$cpu -replace ' CPU ',' '
$cpu=$cpu -replace 'Intel\(R\) Core\(TM\)2 Duo','Core2Duo'
$cpu=$cpu -replace 'Intel\(R\) Pentium\(R\)','Pentium'
$cpu=$cpu -replace 'Intel\(R\) Core\(TM\)','Core'
$cpu=$cpu -replace 'Intel\(R\) Celeron\(R\)','Celeron'
$cpu=$cpu -replace 'Intel\(R\) Xeon\(R\)','Xeon'
$cpu=$cpu -replace 'Pentium\(R\) Dual-Core','Pentium'
$cpu=$cpu -replace ' with Radeon\(tm\) HD Graphics',''
$cpu=$cpu -replace ' with Radeon Vega Mobile Gfx',''
$cpu=$cpu -replace ' with Radeon Vega Graphics',''
$cpu=$cpu -replace ' @ ',' '
if ("$cpu" -ne ""){
$memModule=((Get-WmiObject -Class CIM_PhysicalMemory -ComputerName $compAdr).Capacity | ForEach {$mem=[int]($_*10/1073741824)/10; if($mem -ge 0.5){$mem; $memSum=$memSum+$mem}}) -join ' '
$sys=Get-WmiObject -Class CIM_ComputerSystem -ComputerName $compAdr
$model=$sys.model
$model=("$model").Trim()
$model=$model -replace 'System Product Name','Noname'
$model=$model -replace 'To be filled by O.E.M.','Noname'
$model=$model -replace 'VMware Virtual Platform','VMware'
$cores=$sys.NumberOfLogicalProcessors
$compName=$sys.Name+$(if($sys.Domain){"."+$sys.Domain})
$hdd=""; Get-WmiObject -Class CIM_diskdrive -ComputerName $compAdr | ForEach {if($_.Size -gt 0){$hdd+=[string]($_.Model+" "+[int]($_.Size / (1000000000)))+"GB`r`n"}}
Output "`r`n $(addSp $compName 23) $ip`r`n-------------------------------------------------------`r`n$(addSp "CPU" 15) : $cpu($cores core) `r`n$(addSp "Memory" 15) : $memModule (Sum:$memSum`GB) `r`n$(addSp "Manufacturer" 15) : $model"
$(if($hst){Output " ("; Output "$hst" "MediumVioletRed"; Output ")"}); Output "`r`n"
if($hdd){Output "`r`nHard Disk Drive:"; Output "`r`n$hdd" "DarkBlue"}
}
}
код слишком длинный и поэтому не мог полностью кидать сюда.
Вопрос такого характера что кто может добавить код после `r`n$(addSp "Manufacturer" 15) : $model" что бы после модель компьютера показывал и Серийник ? Прошу очень помочь
function CompHw {
if (-not $ip){return}
$hst= ((get-wmiobject -list "StdRegProv" -computername $compAdr -namespace root\default).GetStringValue(2147483650,"SOFTWARE\Microsoft\Virtual Machine\Guest\Parameters","HostName")).sValue
$memSum=0; $model=""; $memModule=""
$cpu=(Get-WmiObject -Class CIM_Processor -ComputerName $compAdr).Name | Select-Object -first 1
$cpu=$cpu -replace ' ',' '; $cpu=$cpu -replace ' ',' '; $cpu=$cpu -replace ' ',' ' ;$cpu=$cpu -replace ' ',' '
$cpu=$cpu -replace ' CPU ',' '
$cpu=$cpu -replace 'Intel\(R\) Core\(TM\)2 Duo','Core2Duo'
$cpu=$cpu -replace 'Intel\(R\) Pentium\(R\)','Pentium'
$cpu=$cpu -replace 'Intel\(R\) Core\(TM\)','Core'
$cpu=$cpu -replace 'Intel\(R\) Celeron\(R\)','Celeron'
$cpu=$cpu -replace 'Intel\(R\) Xeon\(R\)','Xeon'
$cpu=$cpu -replace 'Pentium\(R\) Dual-Core','Pentium'
$cpu=$cpu -replace ' with Radeon\(tm\) HD Graphics',''
$cpu=$cpu -replace ' with Radeon Vega Mobile Gfx',''
$cpu=$cpu -replace ' with Radeon Vega Graphics',''
$cpu=$cpu -replace ' @ ',' '
if ("$cpu" -ne ""){
$memModule=((Get-WmiObject -Class CIM_PhysicalMemory -ComputerName $compAdr).Capacity | ForEach {$mem=[int]($_*10/1073741824)/10; if($mem -ge 0.5){$mem; $memSum=$memSum+$mem}}) -join ' '
$sys=Get-WmiObject -Class CIM_ComputerSystem -ComputerName $compAdr
$model=$sys.model
$model=("$model").Trim()
$model=$model -replace 'System Product Name','Noname'
$model=$model -replace 'To be filled by O.E.M.','Noname'
$model=$model -replace 'VMware Virtual Platform','VMware'
$cores=$sys.NumberOfLogicalProcessors
$compName=$sys.Name+$(if($sys.Domain){"."+$sys.Domain})
$hdd=""; Get-WmiObject -Class CIM_diskdrive -ComputerName $compAdr | ForEach {if($_.Size -gt 0){$hdd+=[string]($_.Model+" "+[int]($_.Size / (1000000000)))+"GB`r`n"}}
Output "`r`n $(addSp $compName 23) $ip`r`n-------------------------------------------------------`r`n$(addSp "CPU" 15) : $cpu($cores core) `r`n$(addSp "Memory" 15) : $memModule (Sum:$memSum`GB) `r`n$(addSp "Manufacturer" 15) : $model"
$(if($hst){Output " ("; Output "$hst" "MediumVioletRed"; Output ")"}); Output "`r`n"
if($hdd){Output "`r`nHard Disk Drive:"; Output "`r`n$hdd" "DarkBlue"}
}
}