powershell 查询 Windows系统 激活状态 激活参数相关

Get-WmiObject -query 'select * from SoftwareLicensingProduct'

中文名称 属性名
类型 __GENUS 2
类名 __CLASS SoftwareLicensingProduct
超类 __SUPERCLASS  
家族 __DYNASTY SoftwareLicensingProduct
相对路径 __RELPATH SoftwareLicensingProduct.ID="0b646350-5349-4013-b1be-4100d1a7fa38"
属性计数 __PROPERTY_COUNT 61
派生 __DERIVATION {}
服务器 __SERVER WIN-SIM65JFFMVQ
命名空间 __NAMESPACE root\cimv2
路径 __PATH \WIN-SIM65JFFMVQ\root\cimv2:SoftwareLicensingProduct.ID="0b646350-5349-4013-b1be-4100d1a7fa38"
AD激活Csvlk产品ID ADActivationCsvlkPid  
AD激活CsvlkSKU ID ADActivationCsvlkSkuId  
AD激活对象DN ADActivationObjectDN  
AD激活对象名称 ADActivationObjectName  
应用程序ID ApplicationID  
自动虚拟机激活主机数字PID2 AutomaticVMActivationHostDigitalPid2  
自动虚拟机激活主机名称 AutomaticVMActivationHostMachineName  
自动虚拟机最后激活时间 AutomaticVMActivationLastActivationTime 16010101000000.000000-000
描述 Description Windows(R) Operating System, OEM_DM channel
发现的KMS机器IP地址 DiscoveredKeyManagementServiceMachineIpAddress  
发现的KMS机器名称 DiscoveredKeyManagementServiceMachineName  
发现的KMS机器端口 DiscoveredKeyManagementServiceMachinePort 0
评估结束日期 EvaluationEndDate 16010101000000.000000-000
扩展宽限期 ExtendedGrace 4294967295
真实状态 GenuineStatus 1
宽限期剩余天数 GracePeriodRemaining 0
IAID IAID  
标识符 ID  
是否为KMS服务器 IsKeyManagementServiceMachine 0
KMS当前计数 KeyManagementServiceCurrentCount 4294967295
KMS失败请求 KeyManagementServiceFailedRequests 4294967295
KMS已授权请求 KeyManagementServiceLicensedRequests 4294967295
KMS查找域 KeyManagementServiceLookupDomain  
KMS机器 KeyManagementServiceMachine  
KMS非正版宽限请求 KeyManagementServiceNonGenuineGraceRequests 4294967295
KMS通知请求 KeyManagementServiceNotificationRequests 4294967295
KMS OOB宽限请求 KeyManagementServiceOOBGraceRequests 4294967295
KMS OOT宽限请求 KeyManagementServiceOOTGraceRequests 4294967295
KMS端口 KeyManagementServicePort 0
KMS产品密钥ID KeyManagementServiceProductKeyID  
KMS总请求 KeyManagementServiceTotalRequests 4294967295
KMS未授权请求 KeyManagementServiceUnlicensedRequests 4294967295
许可依赖于 LicenseDependsOn  
许可家族 LicenseFamily ServerDatacenter
是否为附加许可 LicenseIsAddon False
许可状态 LicenseStatus 0
许可状态原因 LicenseStatusReason 3221549076
机器URL MachineURL  
名称 Name Windows(R), ServerDatacenter edition
离线安装ID OfflineInstallationId  
部分产品密钥 PartialProductKey  
处理器URL ProcessorURL  
产品密钥渠道 ProductKeyChannel  
产品密钥ID ProductKeyID  
产品密钥ID2 ProductKeyID2  
产品密钥URL ProductKeyURL  
剩余应用重新武装次数 RemainingAppReArmCount 1001
剩余SKU重新武装次数 RemainingSkuReArmCount 4294967295
所需客户端计数 RequiredClientCount 4294967295
令牌激活附加信息 TokenActivationAdditionalInfo  
令牌激活证书指纹 TokenActivationCertificateThumbprint  
令牌激活授予编号 TokenActivationGrantNumber 4294967295
令牌激活ILID TokenActivationILID  
令牌激活ILVID TokenActivationILVID 4294967295
可信时间 TrustedTime 20250131110333.271000-000
使用许可证URL UseLicenseURL https://activation-v2.sls.microsoft.com/SLActivateProduct/SLActivateProduct.asmx?configextension=DM
验证URL ValidationURL https://validation-v2.sls.microsoft.com/SLWGA/slwga.asmx
VL激活间隔 VLActivationInterval 120
VL激活类型 VLActivationType 4294967295
VL激活类型启用 VLActivationTypeEnabled 0
VL更新间隔 VLRenewalInterval 10080
PowerShell计算机名称 PSComputerName WIN-

这样组织后的表格更加清晰,方便理解和使用。

 

Get-CimInstance SoftwareLicensingService

中文名称 字段名称
Azure元数据响应 AzureMetadataResponse 4294967295
客户端机器ID ClientMachineID  
发现的密钥管理服务机器IP地址 DiscoveredKeyManagementServiceMachineIpAddress -
发现的密钥管理服务机器名称 DiscoveredKeyManagementServiceMachineName -
发现的密钥管理服务机器端口 DiscoveredKeyManagementServiceMachinePort 0
发出Windows计量器 EmitWindowsMeter 0
是否为密钥管理服务机器 IsKeyManagementServiceMachine 0
密钥管理服务当前计数 KeyManagementServiceCurrentCount 4294967295
密钥管理服务DNS发布 KeyManagementServiceDnsPublishing True
密钥管理服务失败请求数量 KeyManagementServiceFailedRequests 4294967295
密钥管理服务主机缓存 KeyManagementServiceHostCaching True
密钥管理服务已授权请求数量 KeyManagementServiceLicensedRequests 4294967295
密钥管理服务监听端口 KeyManagementServiceListeningPort 1688
密钥管理服务查找域 KeyManagementServiceLookupDomain -
密钥管理服务低优先级 KeyManagementServiceLowPriority False
密钥管理服务机器 KeyManagementServiceMachine -
密钥管理服务非正版宽限请求数 KeyManagementServiceNonGenuineGraceRequests 4294967295
密钥管理服务通知请求数 KeyManagementServiceNotificationRequests 4294967295
密钥管理服务OOB宽限请求数 KeyManagementServiceOOBGraceRequests 4294967295
密钥管理服务OOT宽限请求数 KeyManagementServiceOOTGraceRequests 4294967295
密钥管理服务端口 KeyManagementServicePort 1688
密钥管理服务产品密钥ID KeyManagementServiceProductKeyID -
密钥管理服务总请求数 KeyManagementServiceTotalRequests 4294967295
密钥管理服务未授权请求数 KeyManagementServiceUnlicensedRequests 4294967295
OA2xBios标记次要版本 OA2xBiosMarkerMinorVersion 4294967295
OA2xBios标记状态 OA2xBiosMarkerStatus 0
OA3x原始产品密钥 OA3xOriginalProductKey -
OA3x原始产品密钥描述 OA3xOriginalProductKeyDescription -
OA3x原始产品密钥PKPn OA3xOriginalProductKeyPkPn -
策略缓存刷新是否需要 PolicyCacheRefreshRequired 0
剩余Windows重置计数 RemainingWindowsReArmCount 1001
所需客户端数量 RequiredClientCount 4294967295
订阅版本 SubscriptionEdition UNKNOWN
订阅过期时间 SubscriptionExpiry <unspecified>
订阅状态 SubscriptionStatus 120
订阅类型 SubscriptionType 120
令牌激活附加信息 TokenActivationAdditionalInfo -
令牌激活证书指纹 TokenActivationCertificateThumbprint -
令牌激活授权编号 TokenActivationGrantNumber 4294967295
令牌激活ILID TokenActivationILID -
令牌激活ILVID TokenActivationILVID 4294967295
操作系统版本 Version 10.0.26100.2894
VL激活间隔 VLActivationInterval 4294967295
VL续订间隔 VLRenewalInterval 4294967295
计算机名称 PSComputerName -

此表格现在包括了中文名称、字段名称以及相应的值,便于理解和参考。

 

Windows PowerShell 还提供了其他多种方式来获取与软件授权、许可证和管理相关的信息。以下是一些常用的命令:

  1. Get-WmiObject -Query 'select * from Win32_OperatingSystem'

    • 获取操作系统的相关信息,包括版本、安装日期、产品密钥状态等。
    powershellCopy Code
    Get-WmiObject -Query 'select * from Win32_OperatingSystem'
  2. Get-WmiObject -Query 'select * from Win32_Product'

    • 获取已安装的所有软件列表,包括软件名称、版本等信息。
    powershellCopy Code
    Get-WmiObject -Query 'select * from Win32_Product'
  3. Get-WmiObject -Query 'select * from SoftwareLicensingService'

    • 获取与软件授权管理相关的信息。
    powershellCopy Code
    Get-WmiObject -Query 'select * from SoftwareLicensingService'
  4. Get-CimInstance -ClassName SoftwareLicensingService

    • CIM (Common Information Model) 提供了一个现代化的获取系统信息的命令,可以代替 Get-WmiObject,获取软件授权服务信息。
    powershellCopy Code
    Get-CimInstance -ClassName SoftwareLicensingService
  5. Get-WmiObject -Class Win32_ComputerSystem

    • 获取计算机系统的硬件信息,包括计算机的型号、制造商等。
    powershellCopy Code
    Get-WmiObject -Class Win32_ComputerSystem
  6. Get-WmiObject -Class Win32_OperatingSystem

    • 获取操作系统相关的信息,如名称、版本、已安装的更新等。
    powershellCopy Code
    Get-WmiObject -Class Win32_OperatingSystem
  7. Get-WmiObject -Query 'select * from SoftwareLicensingProduct where PartialProductKey != NULL'

    • 查询所有有效的软件许可,筛选出有部分产品密钥的软件。
    powershellCopy Code
    Get-WmiObject -Query 'select * from SoftwareLicensingProduct where PartialProductKey != NULL'
  8. Get-CimInstance -ClassName Win32_OperatingSystem

    • CIM 版本的 Win32_OperatingSystem 类,获取操作系统的相关信息。
    powershellCopy Code
    Get-CimInstance -ClassName Win32_OperatingSystem
  9. Get-CimInstance -ClassName Win32_Product

    • CIM 版本的 Win32_Product 类,获取已安装软件的信息。
    powershellCopy Code
    Get-CimInstance -ClassName Win32_Product
  10. slmgr.vbs /dli

    • 使用 slmgr.vbs 脚本查看 Windows 激活状态以及许可证类型。命令行工具,适用于获取系统激活信息。
    powershellCopy Code
    slmgr.vbs /dli

这些命令都可以提供有关系统、操作系统和软件许可证的不同层面的信息,可以根据需要选择合适的命令来查询和管理软件授权或许可证。

使用 slmgr.vbs 命令

这是一个直接查询和管理 Windows 激活状态的工具。你可以使用以下命令检查激活状态:

powershellCopy Code
slmgr.vbs /dli

该命令会显示关于当前系统许可证和激活的详细信息。

2. 使用 Get-WmiObject 查询 Win32_OperatingSystem

你也可以尝试查看操作系统的激活状态。虽然这不会显示详细的许可证信息,但可以获得一些有关系统激活的信息:

powershellCopy Code
Get-WmiObject -Class Win32_OperatingSystem | Select-Object Caption, ProductType, RegisteredUser, Status

这将显示当前操作系统的名称、类型、注册用户和激活状态。

3. 使用 Get-CimInstance 替代 Get-WmiObject

如果你更喜欢使用 CimInstance,它是 WmiObject 的更新版,可以尝试以下命令:

powershellCopy Code
Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object Caption, ProductType, RegisteredUser, Status

如果仍然没有显示激活状态或许可证信息,可能需要根据操作系统版本或配置调整查询。

补充一些用于管理和查询Windows系统、软件授权以及许可证的PowerShell命令:

  1. slmgr.vbs /xpr

    • 用于查看当前系统是否永久激活。如果系统已永久激活,它会显示“Windows is activated permanently”。
    powershellCopy Code
    slmgr.vbs /xpr
  2. slmgr.vbs /ipk <product-key>

    • 用于输入或更改Windows产品密钥。适用于激活Windows。
    powershellCopy Code
    slmgr.vbs /ipk <your-product-key>
  3. slmgr.vbs /ato

    • 用于激活Windows操作系统。如果产品密钥已经正确输入,可以用此命令来激活Windows。
    powershellCopy Code
    slmgr.vbs /ato
  4. Get-WmiObject -Class Win32_OperatingSystem | Select-Object -Property Caption, ProductType, Version, BuildNumber

    • 获取操作系统的详细信息,包括版本、产品类型(例如家庭版、专业版)、以及构建号等。
    powershellCopy Code
    Get-WmiObject -Class Win32_OperatingSystem | Select-Object -Property Caption, ProductType, Version, BuildNumber
  5. Get-WmiObject -Class Win32_ComputerSystem | Select-Object Manufacturer, Model, Name, TotalPhysicalMemory

    • 获取计算机的硬件信息,包括制造商、型号、计算机名称以及物理内存总量。
    powershellCopy Code
    Get-WmiObject -Class Win32_ComputerSystem | Select-Object Manufacturer, Model, Name, TotalPhysicalMemory
  6. Get-WmiObject -Class Win32_SoftwareFeature

    • 查询软件特征,这对于某些管理任务(如获取特定软件功能或包的安装状态)非常有用。
    powershellCopy Code
    Get-WmiObject -Class Win32_SoftwareFeature
  7. Get-WmiObject -Class Win32_OperatingSystem | Select-Object Caption, InstallDate, OSArchitecture, ProductType

    • 查看操作系统的安装日期、架构(例如64位或32位)、操作系统类型等详细信息。
    powershellCopy Code
    Get-WmiObject -Class Win32_OperatingSystem | Select-Object Caption, InstallDate, OSArchitecture, ProductType
  8. Get-WmiObject -Class Win32_Volume

    • 获取系统中所有磁盘分区的详细信息,如驱动器字母、大小、文件系统类型等。
    powershellCopy Code
    Get-WmiObject -Class Win32_Volume
  9. Get-WmiObject -Class Win32_NetworkAdapterConfiguration | Select-Object Description, MACAddress, IPAddress

    • 获取网络适配器的配置信息,包括描述、MAC地址和IP地址。
    powershellCopy Code
    Get-WmiObject -Class Win32_NetworkAdapterConfiguration | Select-Object Description, MACAddress, IPAddress
  10. Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -Property Caption, OSArchitecture, ServicePackMajorVersion

    • 查询操作系统的名称、架构、服务包版本等信息。
    powershellCopy Code
    Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -Property Caption, OSArchitecture, ServicePackMajorVersion
  11. Get-WmiObject -Class Win32_SoftwareLicensingProduct | Where-Object {$_.LicenseStatus -eq 1}

    • 查询所有已激活的软件许可证。LicenseStatus -eq 1 表示该软件许可证是有效的。
    powershellCopy Code
    Get-WmiObject -Class Win32_SoftwareLicensingProduct | Where-Object {$_.LicenseStatus -eq 1}
  12. Get-CimInstance -ClassName Win32_Product | Select-Object Name, Version, InstallDate

    • 获取已安装软件的名称、版本和安装日期信息,通常用于软件清单管理。
    powershellCopy Code
    Get-CimInstance -ClassName Win32_Product | Select-Object Name, Version, InstallDate
  13. Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -Property BuildNumber, OSArchitecture

    • 获取操作系统的构建号和架构信息。
    powershellCopy Code
    Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -Property BuildNumber, OSArchitecture
  14. Get-WmiObject -Class Win32_BIOS

    • 获取计算机的BIOS信息,包括版本、制造商、发布日期等。
    powershellCopy Code
    Get-WmiObject -Class Win32_BIOS

这些PowerShell命令和工具可以帮助你管理Windows系统中的硬件、软件、许可证和激活状态等信息。如果需要更细粒度的管理,还可以结合脚本来实现自动化任务或定期检查。

 

posted @   suv789  阅读(71)  评论(0编辑  收藏  举报
点击右上角即可分享
微信分享提示