如何检查 Windows 是否从命令提示符或 powershell 激活?

Ear*_*ven 11 windows powershell command-line windows-activation

如果我想检查 Windows 是否已激活,但又懒得深入菜单系统,或者我使用的是没有桌面体验的 Windows 版本(例如服务器核心),我如何仅使用命令行?

Sim*_*onS 13

一个纯粹的 PowerShell 解决方案是:

Get-CimInstance SoftwareLicensingProduct -Filter "Name like 'Windows%'" | 
where { $_.PartialProductKey } | select Description, LicenseStatus
Run Code Online (Sandbox Code Playgroud)

这将为您提供如下输出:

Description                                 LicenseStatus
-----------                                 -------------
Windows(R) Operating System, OEM_DM channel             1
Run Code Online (Sandbox Code Playgroud)

如果 LicenseStatus 为 1,则表示系统已永久激活。

这样做的好处是,您可以通过指定-ComputerName参数轻松检查 RemoteMachines 。

Get-CimInstance SoftwareLicensingProduct -Filter "Name like 'Windows%'" -ComputerName RemoteComp | 
where { $_.PartialProductKey } | select Description, LicenseStatus
Run Code Online (Sandbox Code Playgroud)

虽然我得说这slmgr /xpr更快,也更清晰。

  • 这将为您节省 14 秒。 `Get-CimInstance SoftwareLicensingProduct -Filter“partialproductkey 不为空” | ?类似名称的窗口*` (2认同)

Ear*_*ven 5

在 Windows 10 或 Windows Server 2016/2019 上,要使用命令提示符(或 powershell)显示激活状态,请打开您首选的命令行工具并输入以下命令

slmgr /xpr
Run Code Online (Sandbox Code Playgroud)

将显示一个对话框,指示操作系统的激活状态。如果操作系统尚未激活,对话框将指示它处于“通知模式”

带有打开对话框的命令提示符,指示 Windows 处于通知模式。

如果 Windows 成功激活,对话框将指示为“永久激活”,如下所示,或者如果使用有时间限制的批量许可证激活,则将显示激活到期的时间。

带有打开对话框的命令提示符,指示 Windows 已永久激活。

在旧版本的 Windows(例如 Windows 7)上,消息对话框将类似,但文本可能略有不同。

在完成向导之前,通过使用 Shift + F10 启动命令提示符,此方法对于在开箱即用体验 (OOBE) 向导期间检查激活状态也很有用。