I want to find what version of Outlook is running on specific workstations. If I manually run
wmic /node:"hostname" product where "Name like '%Office Outlook%'" get Name
in a command line, it works. But if I run it from a batch file, it returns "No instance(s) available". I've even stripped everything else out of the batch file, so only this line is left - and I still get the same result. Am I missing something?
By Typing “wmic product get name” will shows you a list of all application names which is installed on your machine. Use “wmic product get /?” to see the parameters including the output formatting with all other attributes.
The Windows Management Instrumentation Command line (WMIC) is a software utility that allows users to performs Windows Management Instrumentation (WMI) operations with a command prompt.
The WMIC tool is deprecated in Windows 10, version 21H1 and the 21H1 General Availability Channel release of Windows Server. This tool is superseded by Windows PowerShell for WMI.
What is WMIC? The Windows Management Instrumentation (WMI) Command-Line Utility (WMIC) is a command-line utility that allows users to perform WMI operations from a command prompt. WMI is an interface providing a variety of Windows management functions.
In a batch script file:
wmic /node:"hostname" product where "Name like '%%Office Outlook%%'" get Name
For proof, try next in your batch file:
echo ON
wmic /node:"hostname" product where "Name like '%%Office Outlook%%'" get Name
pause
You should see next ECHO
ed command, the same as it would be typed from command prompt:
wmic /node:"hostname" product where "Name like '%Office Outlook%'" get Name
:::::::::::::::::::::::::::::
::: some wmic output here :::
:::::::::::::::::::::::::::::
Press any key to continue . . .
For explanation, read Syntax : Escape Characters, Delimiters and Quotes
Escaping Percents
The % character has a special meaning for command line parameters and FOR parameters.
To treat a percent in a batch script file as a regular character, double it:%%
Read How does the Windows Command Interpreter (CMD.EXE) parse scripts? (entire thread) as well.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With