Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function Get-LicenseInfo {
- Param
- (
- [Parameter(Mandatory=$false,ValueFromPipelineByPropertyName=$true)]
- [String[]]$ComputerName = $env:COMPUTERNAME
- )
- #defined initial data
- $LicenseStatus = @("Unlicensed","Licensed","OOB Grace",
- "OOT Grace","Non-Genuine Grace","Notification","Extended Grace")
- Foreach($CN in $ComputerName)
- {
- Get-CimInstance -ClassName SoftwareLicensingProduct -ComputerName $ComputerName |`
- Where{$_.PartialProductKey -and $_.Name -like "*Windows*"} | Select `
- @{Expression={$_.PSComputerName};Name="ComputerName"},`
- @{Expression={$_.Name};Name="WindowsName"} ,ApplicationID,`
- @{Expression={$LicenseStatus[$($_.LicenseStatus)]};Name="LicenseStatus"}
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement