Table of Contents
Why Microsoft decided to phase out WMIC" >Why Microsoft decided to phase out WMIC
Use PowerShell, WMI and CIM instead of WMIC" >Use PowerShell, WMI and CIM instead of WMIC
CIM cmdlets 使用示例" >CIM cmdlets 使用示例
WMI cmdlets 使用示例" >WMI cmdlets 使用示例
WMIC 脚本向 PowerShell 转换" >WMIC 脚本向 PowerShell 转换
Home Computer Tutorials Computer Knowledge WMIC is finally coming to an end: How to migrate to PowerShell, a required course for system administrators

WMIC is finally coming to an end: How to migrate to PowerShell, a required course for system administrators

Mar 04, 2024 am 10:00 AM
windows wmic data access

WMIC 终将谢幕:如何迁移到 PowerShell,系统管理员的必修课

WMIC is an important tool for system administrators. It provides an efficient and precise way to manage Windows systems under the "Command Prompt". Administrators can use WMIC to perform system configuration, query and monitoring operations.

Microsoft has announced that WMIC will be phased out in future Windows versions:

  • Windows 10 21H1: The WMIC user interface (UI) is no longer recommended.
  • Windows 11 23H2 and 22H2: WMIC is provided as an "optional feature" but is still installed by default.
  • Windows 11 24H2: WMIC will be completely removed.

In addition, starting from January 29, 2024, WMIC is only provided as an optional feature in the Windows preview version and is no longer installed by default.

So, what should users who rely on WMIC do for their work? Microsoft recommends using Windows PowerShell instead of WMIC.

PowerShell is a command line interpreter and scripting environment based on the .NET Framework with more powerful features and more flexible syntax.

Next, let us first review the main functions of WMIC, and then introduce how to use PowerShell to replace these functions.

What is WMIC

WMIC stands for Windows Management Instrumentation Command-line, which is a command line tool. It provides access to Windows Management Instrumentation (WMI). WMI is a powerful management framework in Windows for data management and operations.

By using WMIC, administrators can easily perform various Windows management tasks. Combined with WMI scripts and applications, as well as WinRM (Windows Remote Management) and SCCM (System Center Configuration Manager), management tasks can be automated on remote computers. WMIC provides powerful functions to easily access and manage various information and functions of the Windows operating system through the command line or scripts. Administrators can use WMIC to query system information, install software, configure network settings, etc. At the same time, WMIC also supports remote management, and administrators can easily manage multiple computers through remote connections. By combining WMI scripts and applications, administrators can more flexibly customize management tasks and achieve automated execution. With the help of tools such as WinRM and SCCM, remote management can be carried out more efficiently, improving management efficiency and reducing manual operations

Tight integration with WMIC allows users to query and adjust system settings. For example, Windows screen brightness can be easily adjusted through WMIC. Use the following WMIC commands to get your computer's model, name, manufacturer, and system type.

wmic computersystem get manufacturer,model,name,systemtype
Copy after login

Use WMIC command to obtain computer information

This command can quickly provide key system information and is extremely useful for system administrators.

Why Microsoft decided to phase out WMIC

WMIC Deprecation Timetable

Since WMIC is so easy to use, why does Microsoft abandon it and promote PowerShell as a replacement? This decision is mainly based on the following reasons:

  1. Technology Development: PowerShell provides a more modern and powerful way to access and manage WMI, as well as many other system management functions. It supports more complex scripts, more flexible commands, and a broader feature set, making it the first choice for system administration tasks.
  2. Performance improvement: Compared with WMIC, PowerShell usually performs better in terms of performance and efficiency. Especially when processing large amounts of data or performing complex management tasks, PowerShell cmdlets run more efficiently.
  3. Security considerations: WMIC may be used by malware or attackers to execute remote commands or deploy malicious code. PowerShell effectively reduces this type of risk by implementing powerful security features such as policy control and more detailed permission management.
  4. Unified standards: Centralizing the use of PowerShell to manage system tasks helps to unify and standardize the tool set, simplify system management work, improve efficiency, and reduce the need for administrators to switch between different tools.
  5. Community support: PowerShell has an active community that provides a wealth of resources, scripts, and modules. Continuous investment by Microsoft and the community ensures that PowerShell is constantly updated and improved, while the development of WMIC has been relatively stagnant.

Although WMIC was a very useful management tool in the past, as technology evolves and new tools emerge, Microsoft believes that a move to more modern, more secure, and more powerful management tools is necessary.

This reflects an industry norm: As technology advances, old tools will be replaced by new, more advanced tools to meet the needs of modern IT environments.

Use PowerShell, WMI and CIM instead of WMIC

Before we formally explore alternatives, we need to clarify several core concepts:

  • Windows 系统内置了 WMI 和 CIM 的 cmdlets,为管理员提供了强大的管理工具。
  • WMI(Windows 管理接口)基于 CIM(通用信息模型)标准,主要用于获取和展示计算机信息。CIM 是行业通用标准,虽然它本身不直接支持远程数据访问,但 WMI 利用了 DCOM(分布式组件对象模型)和 RPC(远程过程调用)等技术,实现了在网络连接的远程系统上使用 CIM。不过,WMI 在通过防火墙进行远程设备查询时存在一定局限性。
  • PowerShell 中的 WMI 和 CIM cmdlets 是向着更安全、更高效、兼容性更强的管理工具转型的重要一步。接下来,我们将通过一些基本实例,帮助你完成这一转型过程。

CIM cmdlets 使用示例

CIM cmdlets 通过 WS-Management 协议实现数据交换,该协议比 DCOM 更适合远程管理,尤其是在需要穿透防火墙时。

  • 获取系统信息
Get-CimInstance -ClassName CIM_ComputerSystem
Copy after login

该命令会显示当前计算机的系统信息,输出内容与 WMIC 命令相似。

使用 Get-CimInstance 获取系统信息

  • 获取启动配置
Get-CimInstance -ClassName CIM_OperatingSystem
Copy after login

该命令提供了操作系统的详细信息,包括系统目录、构建号和版本信息等。

WMI cmdlets 使用示例

虽然比较推荐使用 CIM cmdlets,但 PowerShell 同样支持直接使用 WMI 的 cmdlets。例如:

  • 获取进程列表
Get-WmiObject -Class Win32_Process
Copy after login

该命令会列出当前运行的所有进程。

使用 Get-WmiObject 查看进程列表

  • 获取服务状态
Get-WmiObject -Class Win32_Service | Where-Object {$_.State -eq "Running"}
Copy after login

该命令会筛选出所有当前正在运行的服务。

使用 Get-WmiObject 查看运行的服务

WMIC 脚本向 PowerShell 转换

如果你之前主要使用 WMIC 进行管理任务,现在可以考虑将这些脚本转换为 PowerShell cmdlets。

PowerShell 提供了更多命令选项和更灵活的脚本功能,在多数情况下,这个转换过程直接且简单。

转换过程中,Get-CommandGet-Help cmdlets 能帮助你快速找到对应的 PowerShell 命令,及其使用方法。

例如,要查找所有与实例相关的可用 CIM 命令,可以使用:

Get-Command -Noun CimInstance*
Copy after login

使用 Get-Help 获取帮助

同时,Get-Help命令能提供特定 cmdlet 的详细使用说明和示例,这对学习新命令非常有帮助:

Get-Help Get-CimInstance -Full
Copy after login

通过这种方式,你就可以逐步替换 WMIC 命令,从而提高系统管理的效率和安全性。

要深入了解 PowerShell 中的 WMI 和 CIM 命令使用方法,可以参考微软发布的这篇指南。

自 2016 年起,微软就已经开始逐步淘汰 WMIC。虽然没有宣布具体的弃用日期,但想必已经迫在眉睫。因此,建议系统管理员尽快开始探索迁移解决方案,把 PowerShell 的 WMI 和 CIM 工具融入日常管理工作和编程任务中。

The above is the detailed content of WMIC is finally coming to an end: How to migrate to PowerShell, a required course for system administrators. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1657
14
PHP Tutorial
1257
29
C# Tutorial
1229
24
Can I install mysql on Windows 7 Can I install mysql on Windows 7 Apr 08, 2025 pm 03:21 PM

Yes, MySQL can be installed on Windows 7, and although Microsoft has stopped supporting Windows 7, MySQL is still compatible with it. However, the following points should be noted during the installation process: Download the MySQL installer for Windows. Select the appropriate version of MySQL (community or enterprise). Select the appropriate installation directory and character set during the installation process. Set the root user password and keep it properly. Connect to the database for testing. Note the compatibility and security issues on Windows 7, and it is recommended to upgrade to a supported operating system.

Can mysql and mariadb coexist Can mysql and mariadb coexist Apr 08, 2025 pm 02:27 PM

MySQL and MariaDB can coexist, but need to be configured with caution. The key is to allocate different port numbers and data directories to each database, and adjust parameters such as memory allocation and cache size. Connection pooling, application configuration, and version differences also need to be considered and need to be carefully tested and planned to avoid pitfalls. Running two databases simultaneously can cause performance problems in situations where resources are limited.

How to solve mysql cannot connect to local host How to solve mysql cannot connect to local host Apr 08, 2025 pm 02:24 PM

The MySQL connection may be due to the following reasons: MySQL service is not started, the firewall intercepts the connection, the port number is incorrect, the user name or password is incorrect, the listening address in my.cnf is improperly configured, etc. The troubleshooting steps include: 1. Check whether the MySQL service is running; 2. Adjust the firewall settings to allow MySQL to listen to port 3306; 3. Confirm that the port number is consistent with the actual port number; 4. Check whether the user name and password are correct; 5. Make sure the bind-address settings in my.cnf are correct.

Unable to access mysql from terminal Unable to access mysql from terminal Apr 08, 2025 pm 04:57 PM

Unable to access MySQL from the terminal may be due to: MySQL service not running; connection command error; insufficient permissions; firewall blocks connection; MySQL configuration file error.

How to copy and paste mysql How to copy and paste mysql Apr 08, 2025 pm 07:18 PM

Copy and paste in MySQL includes the following steps: select the data, copy with Ctrl C (Windows) or Cmd C (Mac); right-click at the target location, select Paste or use Ctrl V (Windows) or Cmd V (Mac); the copied data is inserted into the target location, or replace existing data (depending on whether the data already exists at the target location).

Can vs code run in Windows 8 Can vs code run in Windows 8 Apr 15, 2025 pm 07:24 PM

VS Code can run on Windows 8, but the experience may not be great. First make sure the system has been updated to the latest patch, then download the VS Code installation package that matches the system architecture and install it as prompted. After installation, be aware that some extensions may be incompatible with Windows 8 and need to look for alternative extensions or use newer Windows systems in a virtual machine. Install the necessary extensions to check whether they work properly. Although VS Code is feasible on Windows 8, it is recommended to upgrade to a newer Windows system for a better development experience and security.

How to run sublime after writing the code How to run sublime after writing the code Apr 16, 2025 am 08:51 AM

There are six ways to run code in Sublime: through hotkeys, menus, build systems, command lines, set default build systems, and custom build commands, and run individual files/projects by right-clicking on projects/files. The build system availability depends on the installation of Sublime Text.

How to solve complex BelongsToThrough relationship problem in Laravel? Use Composer! How to solve complex BelongsToThrough relationship problem in Laravel? Use Composer! Apr 17, 2025 pm 09:54 PM

In Laravel development, dealing with complex model relationships has always been a challenge, especially when it comes to multi-level BelongsToThrough relationships. Recently, I encountered this problem in a project dealing with a multi-level model relationship, where traditional HasManyThrough relationships fail to meet the needs, resulting in data queries becoming complex and inefficient. After some exploration, I found the library staudenmeir/belongs-to-through, which easily installed and solved my troubles through Composer.

See all articles