Invoke-AzVMInstallPatch
Installs patches on the VM
Invoke-AzVMInstallPatch
-ResourceGroupName <String>
-VMName <String>
[-Windows]
-RebootSetting <String>
-MaximumDuration <String>
[-KBNumberToInclude <String[]>]
[-KBNumberToExclude <String[]>]
[-ExcludeKBsRequiringReboot]
[-ClassificationToIncludeForWindows <String[]>]
[-AsJob]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Invoke-AzVMInstallPatch
-ResourceGroupName <String>
-VMName <String>
[-Linux]
-RebootSetting <String>
-MaximumDuration <String>
[-PackageNameMaskToInclude <String[]>]
[-PackageNameMaskToExclude <String[]>]
[-ClassificationToIncludeForLinux <String[]>]
[-AsJob]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Invoke-AzVMInstallPatch
-ResourceId <String>
[-Windows]
-RebootSetting <String>
-MaximumDuration <String>
[-KBNumberToInclude <String[]>]
[-KBNumberToExclude <String[]>]
[-ExcludeKBsRequiringReboot]
[-ClassificationToIncludeForWindows <String[]>]
[-AsJob]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Invoke-AzVMInstallPatch
-ResourceId <String>
[-Linux]
-RebootSetting <String>
-MaximumDuration <String>
[-PackageNameMaskToInclude <String[]>]
[-PackageNameMaskToExclude <String[]>]
[-ClassificationToIncludeForLinux <String[]>]
[-AsJob]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Invoke-AzVMInstallPatch
[-VM] <PSVirtualMachine>
[-Windows]
-RebootSetting <String>
-MaximumDuration <String>
[-KBNumberToInclude <String[]>]
[-KBNumberToExclude <String[]>]
[-ExcludeKBsRequiringReboot]
[-ClassificationToIncludeForWindows <String[]>]
[-AsJob]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Invoke-AzVMInstallPatch
[-VM] <PSVirtualMachine>
[-Linux]
-RebootSetting <String>
-MaximumDuration <String>
[-PackageNameMaskToInclude <String[]>]
[-PackageNameMaskToExclude <String[]>]
[-ClassificationToIncludeForLinux <String[]>]
[-AsJob]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Installs patches on the VM
Invoke-AzVmInstallPatch -ResourceGroupName 'MyRG' -VmName 'MyVM' -Windows -RebootSetting 'never' -MaximumDuration PT2H -ClassificationToIncludeForWindows Critical
This example installs critical patches on the VM.
$myVM = Get-AzVM -ResourceGroupName 'MyRG' -Name 'MyVM'
Invoke-AzVmInstallPatch -VM $myVM -MaximumDuration "PT90M" -RebootSetting "Always" -Windows -ClassificationToIncludeForWindows "Security" -KBNumberToInclude "KB1234567", "KB123567" -KBNumberToExclude "KB1234702", "KB1234802" -ExcludeKBsRequiringReboot
This example passes a PSVirtualMachine object to '-VM' parameter. It also installs security patches while including and excluding certain KBs by using '-KBNumberToExclude' and '-KBNumberToInclude'. It also excludes KBs that require reboot by using '-ExcludeKBsRequiringReboot'.
$myLinuxVM = Get-AzVM -ResourceGroupName 'MyRG' -Name 'MyLinuxVM'
Invoke-AzVMInstallPatch -ResourceId $myLinuxVM.id -MaximumDuration "PT90M" -RebootSetting "Always" -Linux -ClassificationToIncludeForLinux "Security" -PackageNameMaskToInclude "package123" -PackageNameMaskToExclude "package567"
This example installs certain packages to the Linux VM provided by Resource ID.
Run cmdlet in the background
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
The update classifications to select when installing patches. Possible values differ for Windows and Linux.
Type: | String[] |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
The update classifications to select when installing patches. Possible values differ for Windows and Linux.
Type: | String[] |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Prompts you for confirmation before running the cmdlet.
Type: | SwitchParameter |
Aliases: | cf |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
The credentials, account, tenant, and subscription used for communication with Azure.
Type: | IAzureContextContainer |
Aliases: | AzContext, AzureRmContext, AzureCredential |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Filters out KBs that don't have a reboot behavior of 'NeverReboots' when this is set. This parameter is only available for Windows VM.
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
KBs to exclude in the patch operation. This parameter is only available for Windows VM.
Type: | String[] |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
KBs to include in the patch operation. This parameter is only available for Windows VM.
Type: | String[] |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
For Linux VM
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Specifies the maximum amount of time that the operation will run. It must be an ISO 8601-compliant duration string such as PT2H (2 hours).
Type: | String |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Packages to exclude in the patch operation. Format: packageName_packageVersion. This parameter is only available for Linux VM.
Type: | String[] |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Packages to include in the patch operation. Format: packageName_packageVersion. This parameter is only available for Linux VM.
Type: | String[] |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Defines when it is acceptable to reboot a VM during a software update operation.
Type: | String |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
The resource group name.
Type: | String |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
Resource ID for your virtual machine.
Type: | String |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
PowerShell Virtual Machine Object
Type: | PSVirtualMachine |
Aliases: | VMProfile |
Position: | 0 |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
Virtual Machine name
Type: | String |
Aliases: | Name |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
Shows what would happen if the cmdlet runs. The cmdlet is not run.
Type: | SwitchParameter |
Aliases: | wi |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
For Windows VM
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Azure PowerShell feedback
Azure PowerShell is an open source project. Select a link to provide feedback: