【生产实测有效】Windows命令行查看激活状态脚本

Windows查看激活状态关键代码通过windows server 自带的PowerShell来执行Get-WmiObject SoftwareLicensingProduct | Select-Object -Property Desc

  • Windows查看激活状态关键代码
    通过windows server 自带的PowerShell来执行
 Get-WmiObject SoftwareLicensingProduct | Select-Object -Property Description, LicenseStatus | findstr "Operating System"|findstr "1$"
 Get-WmiObject SoftwareLicensingProduct | Where-Object { $_.LicenseStatus -eq 1 } | Select-Object -ExpandProperty Description

Windows Operating System - Windows® 7, RETAIL channel

  • 写出来的巡检脚本
    如果License状态是正常的,就返回1,否则返回0
$res =  Get-WmiObject SoftwareLicensingProduct | Where-Object { $_.LicenseStatus -eq 1 } | Select-Object -ExpandProperty Description

if ($res -ne $null)
{
   Write-Output "LicenseStatus 1"
}
else
{
   Write-Output "LicenseStatus 0"
}

发布者:admin,转转请注明出处:http://www.yc00.com/web/1755033472a5229857.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信