Why do I get a “wmic is not recognized as an internal or external command” error on Windows 11 when using MATLAB?

I am trying to call a function in MATLAB on my Windows 11 (24H2) machine. However, I am running into the following error: 
'wmic' is not recognized as an internal or external command, operable program or batch file.
What is causing this error? How can I work around it? 

 Accepted Answer

What This Issue Means:

This is a known issue that may be experienced in Windows 10 21H1 and later, or in Windows 11.  
WMIC, or Windows Management Instrumentation Command-line, is a command-line utility that allows users to perform administrative tasks on Windows systems. It has been widely used in scripts and applications for system management tasks.
Microsoft began deprecating WMIC in Windows 10 21H1 and further restricted its use in subsequent releases. As of Windows 11 24H2, it is disabled by default, with plans to remove it entirely in future releases. This deprecation impacts any code or scripts relying on WMIC for system calls.
Check the list of Deprecated features in the Windows Client on the "What's New" page. You can also refer to the WMI command line (WMIC) utility deprecation page for more information on this deprecation.

Try These Workarounds:

1) Try to enable WMIC: In the Settings app, go to System > Optional features and click "View features" in the "Add an optional feature" row. Check the box for WMIC and proceed through the installation. You may need admin permissions to do this. Ask your IT system administrator for help.
2) Check for MATLAB Updates: If the error is encountered while using a supported MATLAB/Simulink workflow, MathWorks may release updates to address compatibility issues with newer Windows versions. Use the latest MATLAB release and update number if possible.
3) For Hardware Support Package users: If you encounter the error while setting up supported hardware for use with MATLAB/Simulink, try to use the Manual Network Configuration Option if available. Contact MathWorks technical support for further assistance.
4) Use PowerShell instead of WMIC in your code: If your MATLAB code calls WMIC directly (e.g., via system('wmic ...')), consider updating it to use PowerShell commands instead. MATLAB can execute PowerShell commands using:
[status, result] = system('powershell -Command "Get-CimInstance Win32_Processor | Select-Object -ExpandProperty Name"');
Make sure PowerShell is available and properly configured on your system.

More Answers (0)

Categories

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!