Skip to content

Instantly share code, notes, and snippets.

@SQLvariant
Created March 19, 2019 18:37
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 SQLvariant/1bcb1a1696d992eb465f04825e2d4f4c to your computer and use it in GitHub Desktop.
Save SQLvariant/1bcb1a1696d992eb465f04825e2d4f4c to your computer and use it in GitHub Desktop.
Simple PowerShell function to retrieve OS info from a Windows machine.
function Get-MachineInfo($ServerName="localhost")
{
Get-WmiObject win32_computersystem -ComputerName $ServerName |
SELECT DNSHostName,
Manufacturer,
Model,
SystemType,
@{Name="TotalPhysicalMemoryInMB";Expression={"{0:n2}" -f($_.TotalPhysicalMemory/1mb)}},
NumberOfLogicalProcessors,
NumberOfProcessors,
CurrentTimeZone,
DaylightInEffect
}# End Get-MachineInfo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment