Skip to content

Instantly share code, notes, and snippets.

@jfrantz1-r7
Created April 24, 2019 17:25
Show Gist options
  • Select an option

  • Save jfrantz1-r7/0ff396889a2520b855f5244571e7ed91 to your computer and use it in GitHub Desktop.

Select an option

Save jfrantz1-r7/0ff396889a2520b855f5244571e7ed91 to your computer and use it in GitHub Desktop.
$server = "server.name.here"
try {
$svc = Get-WmiObject -List -Class Win32_OperatingSystem -Computer $server `
-ErrorAction Stop
} catch {
"Cannot access WMI on {0}. Error: {1:x}" -f $server, $_.Exception.HResult
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment