Set-Location "c:\Sources" $ArrComputers = gc .\computernames.txt $OutputLog = ".\output.log" # Main log $NotRespondingLog = ".\notresponding.log" # Logging "unqueried" hosts $computername = $env:COMPUTERNAME $currentUser = $env:username $DateInstallation = (Get-WmiObject -class Cim_OperatingSystem).installdate $ErrorActionPreference = "Stop" # Or add '-EA Stop' to Get-WmiObject queries Clear-Host function Decode { If ($args[0] -is [System.Array]) { [System.Text.Encoding]::ASCII.GetString($args[0]) } Else { "0" } } ForEach ($Computer in $ArrComputers) { try { $computerSystem = get-wmiobject Win32_ComputerSystem -Computer $Computer $DATE = [System.Management.ManagementDateTimeConverter]::ToDateTime($DateInstallation) $IP = (Test-Connection -ComputerName $Computer $env:computername -count 1).IPV4Address.ipaddressTOstring $computerBIOS = get-wmiobject Win32_BIOS -Computer $Computer $Version = Get-WmiObject -Namespace "Root\CIMv2" ` -Query "Select * from Win32_ComputerSystemProduct" ` -computer $computer | select -ExpandProperty version } catch { $Computer | Out-File -FilePath $NotRespondingLog -Append -Encoding UTF8 continue