Another variation on the script with some ideas taken from @mjolinor. I also refused to use systeminfo , because at least on my computer it is much slower than using the corresponding WMI request.
while (1) { $tag1 = Read-Host 'Enter tag # or Q to quit' if ($tag1 -eq "Q") { break; } sc.exe \\$tag1 start RemoteRegistry; start-sleep -seconds 2 $OSInfo = get-wmiobject -class win32_operatingsystem -computername $tag1; $OSInfo | Format-Table -Property @{Name="OS Name";Expression={$_.Caption}},@{Name="System Boot Time";Expression={$_.ConvertToDateTime($_.LastBootUpTime)}},@{Name="System Uptime (Days)";Expression={[math]::Round((New-TimeSpan -Start $_.converttodatetime($_.LastBootUpTime)|select-object -expandproperty totaldays),2)}} -AutoSize; Get-EventLog system -computername $tag1 -InstanceId 2147489657 -Newest 10 | format-table EventID,TimeWritten,MachineName -AutoSize }
I'm not sure if WMI needs a remote registry, so you can completely eliminate the sc.exe and sleep . If you do not need it for something else.
alroc source share