Add ciminstancetemplate.ps1
This commit is contained in:
parent
e149ccc3c6
commit
0753f9a15b
14
ciminstancetemplate.ps1
Normal file
14
ciminstancetemplate.ps1
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
$allComputers=Get-Content -Path C:#FILEPATH#
|
||||||
|
foreach($computer in $allComputers)
|
||||||
|
{
|
||||||
|
$cimSession = New-CimSession -ComputerName $computer -SessionOption (New-CimSessionOption -Protocol Dcom)
|
||||||
|
Invoke-CimMethod -CimSession $cimSession -ClassName Win32_Process -MethodName Create -Arguments @{ commandline = 'C:\Windows\system32\winrm.cmd quickconfig -quiet' }
|
||||||
|
Invoke-CimMethod -CimSession $cimSession -query 'select * from win32_service where name = "winrm"' -MethodName startservice
|
||||||
|
$servicetag = Get-CimInstance -ComputerName $computer -class win32_bios | Select SerialNumber
|
||||||
|
$os = Get-CimInstance Win32_OperatingSystem -ComputerName $computer | Select-Object Caption
|
||||||
|
$processor = Get-CimInstance Win32_Processor -ComputerName $computer | Select-Object DeviceID, Name
|
||||||
|
$memory = (Get-CimInstance Win32_PhysicalMemory -ComputerName $computer | Measure-Object -Property capacity -Sum).sum /1gb
|
||||||
|
Write-Host -ForegroundColor Green "$computer `n $servicetag `n $os `n $memory GB `n" && echo $processor
|
||||||
|
Invoke-CimMethod -CimSession $cimSession -query 'select * from win32_service where name = "winrm"' -MethodName stopservice
|
||||||
|
}
|
||||||
|
|
||||||
Loading…
Reference in New Issue
Block a user