You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Use [Get-AzMaintenanceUpdate](https://docs.microsoft.com/powershell/module/az.maintenance/get-azmaintenanceupdate) to see if there are pending updates. Use `-subscription` to specify the Azure subscription of the VM if it is different from the one that you are logged into.
130
130
131
-
If there are no updates, the command will return an error message: `Resource not found...StatusCode: 404`.
131
+
If there are no updates to show, this command will return nothing. Otherwise, it will return a PSApplyUpdate object:
To check for pending updates for a dedicated host. In this example, the output is formatted as a table for readability. Replace the values for the resources with your own.
@@ -156,6 +169,7 @@ Get-AzMaintenanceUpdate `
156
169
-ProviderName Microsoft.Compute | Format-Table
157
170
```
158
171
172
+
159
173
## Apply updates
160
174
161
175
Use [New-AzApplyUpdate](https://docs.microsoft.com/powershell/module/az.maintenance/new-azapplyupdate) to apply pending updates.
@@ -172,6 +186,8 @@ New-AzApplyUpdate `
172
186
-ProviderName Microsoft.Compute
173
187
```
174
188
189
+
On success, this command will return a `PSApplyUpdate` object. You can use the Name attribute in the `Get-AzApplyUpdate` command to check the update status. See [Check update status](#check-update-status).
190
+
175
191
### Dedicated host
176
192
177
193
Apply updates to a dedicated host.
@@ -189,7 +205,16 @@ New-AzApplyUpdate `
189
205
## Check update status
190
206
Use [Get-AzApplyUpdate](https://docs.microsoft.com/powershell/module/az.maintenance/get-azapplyupdate) to check on the status of an update. The commands shown below show the status of the latest update by using `default` for the `-ApplyUpdateName` parameter. You can substitute the name of the update (returned by the [New-AzApplyUpdate](https://docs.microsoft.com/powershell/module/az.maintenance/new-azapplyupdate) command) to get the status of a specific update.
191
207
192
-
If there are no updates to show, the command will return an error message: `Resource not found...StatusCode: 404`.
0 commit comments