How can I inventory remote computers using PowerShell? The answer is using Get-WmiObject on remote computer. This post provides you with a full tutorial. Keep reading if you’re interested.
Windows Management Instrumentation (WMI) is a management infrastructure built-in to Windows for querying management and operations data. It can be used to query local and remote computers for information like running processes, installed software, BIOS information, and much more.
The Get-WmiObject cmdlet gets instances of WMI classes or information about the available WMI classes.You can use the ComputerName parameter to specify a remote computer, so you can connect to WMI remotely.
Next, we’ll see how to use PowerShell Get-WmiObject on remote computer to inventory computer information.
If the Query parameter is specified, the cmdlet runs a WMI query language (WQL) statement. If the List parameter is specified, the cmdlet gets information about the WMI classes that are available in a specified namespace. The ComputerName parameter is used to specify computers. Let’s see some examples.
First, let’s test the WMI connection to the remote computer. The example shows below allowing you to test the WMI connection to the remote computer called PC1.
You can also enumerate the Network Shares list from a remote machine by using Powerahell’s WMI class Win32_Share. Here, FT is nothing but the Format-Table cmdlet, you can change it into FL to display result in list view.
You can use SQL Query like syntax to apply filter in Win32_Share class. The following Powershell script, filters and list only Network Share Folders (Not hidden shares) by adding filter Type=0.
More examples
Example 1: Gets services on theremote computer PC1:
You can also Get the services on a remote computerusing Get-WmiObject remote computerCredential. The following example uses the Credential parameter. The value of the Credential parameter is a user account name. The user is prompted for a password.
Example 2: Stop a service on theremote computer PC1:
Example 3: Get the BIOS on theremote computer PC1:
Note
We should note you that Get-WmiObject cmdlet has been superseded by Get-CimInstancein PowerShell 3.0. For example, the following command displays each running process name along with its kernel time from largest to smallest:
If you want a more direct way to querycomputer management and operations data, we strongly recommend AnyViewer, a free remote desktop program that allows you to remotely control a computer from another. It offers a graphical user interface to a remote computer, which is way direct and intuitive compared to PowerShell.
Step 1. Download, install and launch AnyViewer on both computers.
Step 2. Go to Log in, and then click Sign up. (If you already have signed up on its official website, you can log in directly.)
Step 3. Fill in the signup information.
Step 4. Then you can see you successfully logged in to AnyViewer. Your device will automatically be assigned to the account you've logged in to.
Step 5. Log in to the same AnyViewer account on the two devices, then click One-click control to achieve unattended remote access.
✍Note: If you upgrade your account to a Professional or Enterprise plan, then you’ll have more rights:
Step 6. After you’ve got full control of the remote computer, you can then open any program and manage it as if you’re using it actually.
This post provides you with a full tutorial on how to use PowerShell Get-WmiObject on remote computer to inventory computer information. If you want a more direct and intuitive way to querycomputer management and operations data, you are advised to use AnyViewer.