Uninstall software on remote computers using WMIC

Recently, I wanted to install Nokia Ovi Suite to several computers in a company that started to have problems with their internet provider; it’s a third day when they do not have internet connection. So I thought it’s a good idea to show them how they can use their Nokia E72 phones to connect their laptops to internet.

Well, prior to installing Nokia Ovi Suite I had to uninstall old versions of Nokia PC Suite from 4 systems, remotely. I decided to do it using WMIC instead of ConfigMgr as the Nokia PC Suite was installed on small number of computers. After this, I can proceed with installing Ovi Suite using ConfigMgr. Till then, here is how I uninstalled PC Suite using WMIC.

  1. In a command prompt window, type Runas /user:YourUsername@UPNsuffix cmd.exe (or Runas /user:domain\username cmd.exe) where YourUsername is your domain admin username or any username with admin privileges on the remote computer and UPNsuffix is your UPN suffix. Let’s suppose I use [email protected]
  2. In the command prompt window type the password for user [email protected] and press Enter
  3. Type WMIC
  4. Now, list all Nokia software on a specific computer using the command /node:COMPUTERNAME product where vendor=”Nokia” get name, version
  5. Once we know the software name, we can uninstall specific product using the following command /node:COMPUTERNAME product where name=”Nokia PC Suite” call uninstall. You will see a message like Execute (\\COMPUTERNAME\ROOT\CIMV2:Win32_Product.IdentifyingNumber=”{225DB4AA-3CFF-47E8-B3C8-6DAD713E986E}”,Name=”Nokia PC Suite”,Version=”7.1.51.0″)->Uninstall() (Y/N/?)?
    Type Y and wait for the result.
  6. To make sure Ovi Suite will install successful, I’m going to uninstall all Nokia software (except the runtime) using the same command just replacing the software name.
  7. Now, I can proceed and install Nokia Ovi Suite 3.1.1.78 using ConfigMgr Software Distribution method. By the way, program’s command line for silent install is Nokia_Ovi_Suite_webinstaller_ALL.exe /SILENT=”1″

If vendor name contains spaces, use the following example: wmic product where vendor=”Microsoft Corporation” get name

Find computer model and manufacturer using remote WMI

In case you need to find the computer model and manufacturer of a remote computer, just use the following command in a command prompt window:

%windir%\System32\wbem\WMIC.exe /node:"ComputerNameORIpAddress" ComputerSystem Get Model, Manufacturer

If you need to specify user credentials, use the following command:

%windir%\System32\wbem\WMIC.exe /node:"ComputerNameORIpAddress" /user:"domain\username" /password:"password" ComputerSystem Get Model, Manufacturer

WMI query for processor manufacturer

Following the post regarding how to install drivers based on computer model using WMI query, here is another query you can use in your task sequences to install some processor specific software for example.

To find the processor manufacturer during a task sequence, insert a condition for the step you need, and select Query WMI. Then, for WMI Namespace use root\cimv2. For WQL Query use SELECT * FROM Win32_Processor WHERE Manufacturer like “%GenuineIntel%” or SELECT * FROM Win32_Processor WHERE Manufacturer like “%AuthenticAMD%” depending on what you need.

To find the processor manufacturer of your computer, open a command prompt and type the following: WMIC CPU GET Manufacturer.

Install drivers by computer model using WMI query

When using task sequence, you might want to install different driver packages for different computer models. This can be accomplished by using a WMI query.

First of all you need to have driver packages for all your computer models and know the exact model name for every computer.

To find this, open a command prompt and type WMIC ComputerSystem GET Model (use this command on every computer to find its model).

Then, Edit your task sequence. Add how many steps you need with “Apply Driver Package”. Select the driver package you have created for a certain computer model (HP dc5700 in my case).

Apply Driver Package

In the Options tab, click Add Condition and select Query WMI. In the WMI Query Properties window, make you sure you have root\cimv2 as WMI Namespace and write the following query in the WMI Query input box:

SELECT * FROM Win32_ComputerSystem WHERE Model LIKE “%dc5700%” for HP Compaq dc5700 computer models.

WMI Query

Now, for every driver package, replace the model name with the computer model name the driver package is for. This way, the task sequence will install the correct drivers on every computer that will match the model specified in the query and will skip other steps sending the following status message: “The task sequence execution engine skipped the action (HP Compaq dc5700) in the group (Apply driver packages) because the condition was evaluated to be false”.