Skip to content

Instantly share code, notes, and snippets.

@vexx32
Created March 29, 2019 13:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vexx32/168243502b61e286b1cc7448b09943b1 to your computer and use it in GitHub Desktop.
Save vexx32/168243502b61e286b1cc7448b09943b1 to your computer and use it in GitHub Desktop.
$LiveCred = Get-Credential
$Results = Invoke-Command -ComputerName ComputerA -ScriptBlock {
[PSCustomObject]@{
IP = Get-NetIPConfiguration |
Where-Object { $_.IPv4DefaultGateway -and $_.NetAdapter.Status -ne "Disconnected" } |
ForEach-Object {
$_.IPv4Address.IPAddress
}
LastBoot = (Get-CimInstance -ClassName Win32_OperatingSystem).LastBootUpTime
} -Credential $LiveCred
$IP = $Results.IP
$LastBoot = $Results.LastBoot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment