What’s in the Box?

A Practical Guide to System Inventory with PowerShell

You ever inherit a server and wonder what the state of things are?

This is how you find out, without guessing or clicking around. If you are doing anything remotely serious in IT, you need to know what you are working with. Let us stop guessing and start pulling facts.

Why This Matters

You do not need to know everything about a machine, but you do need to know the right things. This is the kind of information you gather when you are building an asset inventory, documenting an environment, or trying to get a baseline before things scale. It is a starting point for understanding the infrastructure you are responsible for.

The Building Blocks

We are focusing on five fields that answer the most common real world questions. Quickly.

System Name and OS


Get-ComputerInfo | Select-Object CsName, OsName

This shows the computer’s name and the full name of the operating system. It answers the two most common questions you get before anything else happens.

Uptime


(Get-CimInstance Win32_OperatingSystem).LastBootUpTime

This tells you when the machine last restarted. It helps spot systems that have not rebooted in a while or that quietly restarted when no one was looking.

RAM (in GB)


(Get-CimInstance Win32_ComputerSystem).TotalPhysicalMemory / 1GB

This returns how much physical memory is installed, in gigabytes.

Disk Space


Get-CimInstance Win32_LogicalDisk |
  Select-Object DeviceID, @{Name="FreeSpace(GB)";Expression={"{0:N1}" -f ($_.FreeSpace / 1GB)}},
                          @{Name="TotalSize(GB)";Expression={"{0:N1}" -f ($_.Size / 1GB)}}

This gives you the free and total space for each local disk. Good to know before installing anything heavy or investigating space-related alerts.

The Full Script


# System name and OS
Get-ComputerInfo | Select-Object CsName, OsName

# Uptime
(Get-CimInstance Win32_OperatingSystem).LastBootUpTime

# RAM (in GB)
(Get-CimInstance Win32_ComputerSystem).TotalPhysicalMemory / 1GB

# Disk space (all drives)
Get-CimInstance Win32_LogicalDisk |
  Select-Object DeviceID, @{Name="FreeSpace(GB)";Expression={"{0:N1}" -f ($_.FreeSpace / 1GB)}},
                          @{Name="TotalSize(GB)";Expression={"{0:N1}" -f ($_.Size / 1GB)}}

Real World Use Cases

  • When you are creating or updating an asset inventory
  • When you are performing an environment audit for compliance or onboarding
  • When you need to compare current system baselines before and after changes

What is Next?

In the next post, we will walk through creating your first PowerShell function. You will learn how to wrap up repetitive tasks into reusable commands and lay the groundwork for more advanced automation.

Leave a Reply

Your email address will not be published. Required fields are marked *