$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 }