当前位置:网站首页 > 更多 > 玩电脑 > 正文

[玩转系统] PowerShell 获取 Windows 激活密钥

作者:精品下载站 日期:2024-12-14 17:02:57 浏览:16 分类:玩电脑

PowerShell 获取 Windows 激活密钥


使用 PowerShell cmdlet Get-WmiObject 或命令提示符中的 wmic 命令获取 Windows 操作系统的激活密钥。 Windows 激活产品密钥存储在 OA3xOriginalProductKey 属性中。

PowerShell Get-WmiObject cmdlet 使用 SoftwareLicensingServer 类通过属性 OA3xOriginalProductKey 获取 Windows 操作系统的激活密钥。它返回格式为“XXXXX-XXXXX-XXXXX-XXXXX-XXXXX”的产品密钥

命令行 wmic 还用于查找 Windows 操作系统的激活密钥。

在本文中,我们将讨论如何使用 PowerShell 和 cmd 检索 Windows 操作系统的产品密钥。

使用 PowerShell 查找产品激活密钥

要在 PowerShell 中检索 Windows 操作系统的激活密钥,请使用以下脚本。

Get-WmiObject -query 'select * from SoftwareLicensingService' | Select OA3xOriginalProductKey

在上面的 PowerShell 脚本中,Get-WmiObject cmdlet 使用将产品密钥存储在属性 OA3xOriginalProductKey 中的 SoftwareLicensingService 类。

上述 PowerShell 脚本的输出获取 Windows 操作系统的激活密钥。

[玩转系统] PowerShell 获取 Windows 激活密钥

使用 Cmd 检索 Windows 产品密钥

使用命令提示符中的 wmic 命令获取 Windows 产品密钥。

wmic path softwarelicensingservice get OA3xOriginalProductKey

在上面的命令中,wmic 使用路径参数从存储激活密钥的 softwarelicensingservice 类获取 OA3xOriginalProductKey 属性。

上述命令的输出是:

OA3xOriginalProductKey
XXXXX-XXXXX-XXXXX-XXXXX-XXXXX

注意:使用 PowerShell 和 Cmd 命令获取激活密钥已在 Windows 10 上进行测试。

结论

希望上面关于如何使用PowerShell和cmd获取激活密钥的文章对您有所帮助。

您可以在 ShellGeek 主页上找到有关 PowerShell Active Directory 命令和 PowerShell 基础知识的更多主题。

您需要 登录账户 后才能发表评论

取消回复欢迎 发表评论:

关灯