Share via


Sample queries

Az alábbiakban néhány minta lekérdezést talál, amelyek segítenek a felügyelt gépekről gyűjtött frissítésértékelési és üzembe helyezési információk lekérdezésének megkezdésében. Az olyan műveletekből létrehozott naplókról, mint a frissítési értékelések és a telepítések, további információt a lekérdezési naplók áttekintésében talál.

Az összes gép elérhető frissítéseinek listázása frissítési kategória szerint csoportosítva

Az alábbi lekérdezés a gép függőben lévő frissítéseinek listáját adja vissza az értékelés végrehajtásának időpontjával, az értékelés erőforrás-azonosítójával, a gép operációs rendszerének típusával és a frissítés besorolása alapján elérhető operációsrendszer-frissítésekkel.

patchassessmentresources
| where type !has "softwarepatches"
| extend prop = parse_json(properties)
| extend lastTime = properties.lastModifiedDateTime
| extend updateRollupCount = prop.availablePatchCountByClassification.updateRollup, featurePackCount = prop.availablePatchCountByClassification.featurePack, servicePackCount = prop.availablePatchCountByClassification.servicePack, definitionCount = prop.availablePatchCountByClassification.definition, securityCount = prop.availablePatchCountByClassification.security, criticalCount = prop.availablePatchCountByClassification.critical, updatesCount = prop.availablePatchCountByClassification.updates, toolsCount = prop.availablePatchCountByClassification.tools, otherCount = prop.availablePatchCountByClassification.other, OS = prop.osType
| project lastTime, id, OS, updateRollupCount, featurePackCount, servicePackCount, definitionCount, securityCount, criticalCount, updatesCount, toolsCount, otherCount

Frissítéstelepítések száma

Az alábbi lekérdezés a frissítéstelepítések listáját adja vissza az elmúlt hét napban a gépek állapotával. Az eredmények közé tartozik a frissítés üzembe helyezésének időpontja, a telepítés erőforrás-azonosítója, a gép részletei, valamint a telepített operációsrendszer-frissítések száma az állapotuk és a kiválasztott beállítások alapján.

patchinstallationresources
| where type !has "softwarepatches"
| extend machineName = tostring(split(id, "/", 8)), resourceType = tostring(split(type, "/", 0)), tostring(rgName = split(id, "/", 4))
| extend prop = parse_json(properties)
| extend lTime = todatetime(prop.lastModifiedDateTime), OS = tostring(prop.osType), installedPatchCount = tostring(prop.installedPatchCount), failedPatchCount = tostring(prop.failedPatchCount), pendingPatchCount = tostring(prop.pendingPatchCount), excludedPatchCount = tostring(prop.excludedPatchCount), notSelectedPatchCount = tostring(prop.notSelectedPatchCount)
| where lTime > ago(7d)
| project lTime, RunID=name,machineName, rgName, resourceType, OS, installedPatchCount, failedPatchCount, pendingPatchCount, excludedPatchCount, notSelectedPatchCount

A Windows Server operációs rendszer frissítési telepítéseinek listája

Az alábbi lekérdezés a Windows Server frissítési telepítéseinek listáját adja vissza az elmúlt hét napban a gépek állapotával. Az eredmények közé tartozik a frissítés üzembe helyezésének időpontja, a telepítés erőforrás-azonosítója, a gép részletei és más kapcsolódó üzembe helyezési adatok.

patchinstallationresources
| where type has "softwarepatches" and properties !has "version"
| extend machineName = tostring(split(id, "/", 8)), resourceType = tostring(split(type, "/", 0)), tostring(rgName = split(id, "/", 4)), tostring(RunID = split(id, "/", 10))
| extend prop = parse_json(properties)
| extend lTime = todatetime(prop.lastModifiedDateTime), patchName = tostring(prop.patchName), kbId = tostring(prop.kbId), installationState = tostring(prop.installationState), classifications = tostring(prop.classifications)
| where lTime > ago(7d)
| project lTime, RunID, machineName, rgName, resourceType, patchName, kbId, classifications, installationState
| sort by RunID

Linux operációsrendszer-frissítés telepítéseinek listája

Az alábbi lekérdezés a linuxos frissítéstelepítések listáját adja vissza az elmúlt hét napban a gépek állapotával. Az eredmények közé tartozik a frissítés üzembe helyezésének időpontja, a telepítés erőforrás-azonosítója, a gép részletei és más kapcsolódó üzembe helyezési adatok.

patchinstallationresources
| where type has "softwarepatches" and properties has "version"
| extend machineName = tostring(split(id, "/", 8)), resourceType = tostring(split(type, "/", 0)), tostring(rgName = split(id, "/", 4)), tostring(RunID = split(id, "/", 10))
| extend prop = parse_json(properties)
| extend lTime = todatetime(prop.lastModifiedDateTime), patchName = tostring(prop.patchName), version = tostring(prop.version), installationState = tostring(prop.installationState), classifications = tostring(prop.classifications)
| where lTime > ago(7d)
| project lTime, RunID, machineName, rgName, resourceType, patchName, version, classifications, installationState
| sort by RunID

A karbantartás futási rekordjának listája a virtuális gép szintjén

Az alábbi lekérdezés egy virtuális gép karbantartási futási rekordjainak listáját adja vissza

maintenanceresources 
| where ['id'] contains "/subscriptions/<subscription-id>/resourcegroups/<resource-group>/providers/microsoft.compute/virtualmachines/<vm-name>" //VM Id here
| where ['type'] == "microsoft.maintenance/applyupdates" 
| where properties.maintenanceScope == "InGuestPatch"

Következő lépések

  • Tekintse át az Azure-beli Update Manager naplóit és keresési eredményeit az Azure Resource Graph használatával.
  • Az Update Manager hibáinak elhárítása, lásd a hibaelhárítást.