Invoke-AzVMInstallPatch
Installs patches on the VM
Syntax
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>]
Description
Installs patches on the VM
Examples
Example 1
Invoke-AzVmInstallPatch -ResourceGroupName 'MyRG' -VmName 'MyVM' -Windows -RebootSetting 'never' -MaximumDuration PT2H -ClassificationToIncludeForWindows Critical
This example installs critical patches on the VM.
Example 2
$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'.
Example 3
$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.
Parameters
-AsJob
Run cmdlet in the background
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-ClassificationToIncludeForLinux
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 |
-ClassificationToIncludeForWindows
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 |
-Confirm
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 |
-DefaultProfile
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 |
-ExcludeKBsRequiringReboot
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 |
-KBNumberToExclude
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 |
-KBNumberToInclude
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 |
-Linux
For Linux VM
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-MaximumDuration
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 |
-PackageNameMaskToExclude
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 |
-PackageNameMaskToInclude
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 |
-RebootSetting
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 |
-ResourceGroupName
The resource group name.
Type: | String |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-ResourceId
Resource ID for your virtual machine.
Type: | String |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-VM
PowerShell Virtual Machine Object
Type: | PSVirtualMachine |
Aliases: | VMProfile |
Position: | 0 |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-VMName
Virtual Machine name
Type: | String |
Aliases: | Name |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-WhatIf
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 |
-Windows
For Windows VM
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Inputs
Outputs
Azure PowerShell