hi, I am looking to get the windows boot time using the PSsession from a remote computer. I am looking for a script/command that will run New-pssession in a loop till the connection is established with the remote machine. i can then use it with Measure-command cmdlet to get the time taken. Can someone please help with it.
From what you write I believe you are trying to check remote machines for the there last boot time ?
If this is the case you are much better of using the 'Invoke-Command' cmdlet. You can pass machines to the pipeline and run a scriptblock against them with a command to check lastBootTime. An example always helps, this might be what you are after: