Skip to content

Instantly share code, notes, and snippets.

View cmaahs's full-sized avatar

Christopher Maahs cmaahs

  • Minnetonka, MN, USA
View GitHub Profile
@cmaahs
cmaahs / Get-OSInfo.ps1
Created December 14, 2011 19:04
Useful Powershell Functions
Function Get-OSInfo {
param($RemotePC)
$OSInfo = "" | Select OSName,OSVersion,OSArchitecture,OSFamily,OSType,Status
$OSInfo.Status = $true
$PingStatus = Gwmi Win32_PingStatus -Filter "Address = '$RemotePC'" | Select-Object StatusCode
If ($PingStatus.StatusCode -eq 0) {
$error.Clear()
Try {
$CompSys = Gwmi Win32_ComputerSystem -Comp $RemotePC -ErrorAction Stop