Category filter

Script to collect Windows System Information

As an IT administrator of an organization, you might have numerous reasons to gather various device information about your Windows endpoints. For example, you might need specific info regarding the system for troubleshooting or to check the feasibility of running a software application. There are multiple ways to achieve this:

  • Using the System Information tool
  • Third-party applications
  • Executing commands via the Command Prompt or PowerShell

Achieving this manually across a large fleet of devices may not be feasible. Instead, you can remotely fetch the required computer information by running scripts via the Execute Custom Script action from Hexnode.


The Sample Scripts provided below are adapted from third-party Open-Source sites.

Batch Command to Collect Windows System Information

The following batch command will display a comprehensive list of device information such as the BIOS version, processor info, product ID, boot drive info, network details, etc.

PowerShell Commands to Collect Windows Device Information

You can use the Get-CimInstance cmdlet and specify the correct WMI Class to query information about a Windows device through the WMI (Windows Management Instrumentation) service. Each WMI Class represents specific device-related info.

Display Processor Info

You can retrieve the processor information using Win32_Processor class. The following PowerShell command will display the general details about the device processor:

Display BIOS Info

PowerShell command to collect the information about the system BIOS:

Display Computer Manufacturer and Model

PowerShell command to collect the computer model info:


Some information may not be correctly configured by hardware manufacturers and will therefore be unavailable on running above the command.

List Operating System Version Information

You can use the Win32_OperatingSystem class to list the version and service pack information of the device’s operating system.

PowerShell command:

List Local Users

Local user information such as the registered owner and number of users can also be collected using the Win32_OperatingSystem class by specifying the required properties.

The PowerShell command below can be used to list the number of licensed users, the current number of users and the owner name.

List Installed Hotfixes

Run the following PowerShell command to get a list of Hotfixes installed on the device:

Display Available Disk Space

PowerShell command to get the available disk space on the computer:

The above command will return info about all the drives on the Windows device. To filter out information about a specific drive, you can use the DriveType parameter.

For example, to get the available disk space on fixed hard disks:

Get-CimInstance -ClassName Win32_LogicalDisk -Filter "DriveType=3"

Display the User Logged on to a Computer

PowerShell command to display the user logged on to the Windows device:

Display the Local Time from a Computer

Execute the following PowerShell command to get the current local time on the computer:


  • It is recommended to manually validate the script execution on a system before executing the action in bulk.
  • Hexnode will not be responsible for any damage/loss to the system on the behavior of the script.

  • Sample Script Repository