Enriquece inventário do Windows e layout dos cards
This commit is contained in:
parent
26ae2aa8e5
commit
11390a9d83
2 changed files with 56 additions and 27 deletions
|
|
@ -693,19 +693,30 @@ fn collect_windows_extended() -> serde_json::Value {
|
|||
// Informações de build/edição e ativação
|
||||
let os_info = ps(r#"
|
||||
$cv = Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion';
|
||||
$os = Get-CimInstance Win32_OperatingSystem -ErrorAction SilentlyContinue;
|
||||
$lsItems = Get-CimInstance -Query "SELECT Name, LicenseStatus, PartialProductKey FROM SoftwareLicensingProduct WHERE PartialProductKey IS NOT NULL" | Where-Object { $_.Name -like 'Windows*' };
|
||||
$activatedItem = $lsItems | Where-Object { $_.LicenseStatus -eq 1 } | Select-Object -First 1;
|
||||
$primaryItem = if ($activatedItem) { $activatedItem } else { $lsItems | Select-Object -First 1 };
|
||||
$lsCode = if ($primaryItem -and $primaryItem.LicenseStatus -ne $null) { [int]$primaryItem.LicenseStatus } else { 0 };
|
||||
[PSCustomObject]@{
|
||||
ProductName = $cv.ProductName
|
||||
CurrentBuild = $cv.CurrentBuild
|
||||
CurrentBuildNumber = $cv.CurrentBuildNumber
|
||||
DisplayVersion = $cv.DisplayVersion
|
||||
ReleaseId = $cv.ReleaseId
|
||||
EditionID = $cv.EditionID
|
||||
LicenseStatus = $lsCode
|
||||
IsActivated = ($activatedItem -ne $null)
|
||||
ProductName = $cv.ProductName
|
||||
CurrentBuild = $cv.CurrentBuild
|
||||
CurrentBuildNumber = $cv.CurrentBuildNumber
|
||||
DisplayVersion = $cv.DisplayVersion
|
||||
ReleaseId = $cv.ReleaseId
|
||||
EditionID = $cv.EditionID
|
||||
UBR = $cv.UBR
|
||||
CompositionEditionID = $cv.CompositionEditionID
|
||||
InstallationType = $cv.InstallationType
|
||||
InstallDate = $cv.InstallDate
|
||||
InstallationDate = $os.InstallDate
|
||||
InstalledOn = $os.InstallDate
|
||||
Version = $os.Version
|
||||
BuildNumber = $os.BuildNumber
|
||||
Caption = $os.Caption
|
||||
FeatureExperiencePack = $cv.FeatureExperiencePack
|
||||
LicenseStatus = $lsCode
|
||||
IsActivated = ($activatedItem -ne $null)
|
||||
}
|
||||
"#).unwrap_or_else(|| json!({}));
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue