Note
Access to this page requires authorization. You can try signing in or .
Access to this page requires authorization. You can try .
Invoke-AzVMInstallPatch
- Module:
- Az.Compute Module
Installs patches on the VM
Syntax
WindowsDefaultParameterSet (Default)
Invoke-AzVMInstallPatch
-ResourceGroupName <String>
-VMName <String>
-RebootSetting <String>
-MaximumDuration <String>
[-Windows]
[-KBNumberToInclude <String[]>]
[-KBNumberToExclude <String[]>]
[-ExcludeKBsRequiringReboot]
[-ClassificationToIncludeForWindows <String[]>]
[-AsJob]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
LinuxDefaultParameterSet
Invoke-AzVMInstallPatch
-ResourceGroupName <String>
-VMName <String>
-RebootSetting <String>
-MaximumDuration <String>
[-Linux]
[-PackageNameMaskToInclude <String[]>]
[-PackageNameMaskToExclude <String[]>]
[-ClassificationToIncludeForLinux <String[]>]
[-AsJob]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
WindowsResourceIDParameterSet
Invoke-AzVMInstallPatch
-ResourceId <String>
-RebootSetting <String>
-MaximumDuration <String>
[-Windows]
[-KBNumberToInclude <String[]>]
[-KBNumberToExclude <String[]>]
[-ExcludeKBsRequiringReboot]
[-ClassificationToIncludeForWindows <String[]>]
[-AsJob]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
LinuxResourceIDParameterSet
Invoke-AzVMInstallPatch
-ResourceId <String>
-RebootSetting <String>
-MaximumDuration <String>
[-Linux]
[-PackageNameMaskToInclude <String[]>]
[-PackageNameMaskToExclude <String[]>]
[-ClassificationToIncludeForLinux <String[]>]
[-AsJob]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
WindowsInputObjectParameterSet
Invoke-AzVMInstallPatch
[-VM] <PSVirtualMachine>
-RebootSetting <String>
-MaximumDuration <String>
[-Windows]
[-KBNumberToInclude <String[]>]
[-KBNumberToExclude <String[]>]
[-ExcludeKBsRequiringReboot]
[-ClassificationToIncludeForWindows <String[]>]
[-AsJob]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
LinuxInputObjectParameterSet
Invoke-AzVMInstallPatch
[-VM] <PSVirtualMachine>
-RebootSetting <String>
-MaximumDuration <String>
[-Linux]
[-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
Parameter properties
| Type: | SwitchParameter |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-ClassificationToIncludeForLinux
The update classifications to select when installing patches. Possible values differ for Windows and Linux.
Parameter properties
| Type: | String[] |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-ClassificationToIncludeForWindows
The update classifications to select when installing patches. Possible values differ for Windows and Linux.
Parameter properties
| Type: | String[] |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-Confirm
Prompts you for confirmation before running the cmdlet.
Parameter properties
| Type: | SwitchParameter |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
| Aliases: | cf |
Parameter sets
-DefaultProfile
The credentials, account, tenant, and subscription used for communication with Azure.
Parameter properties
| Type: | IAzureContextContainer |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
| Aliases: | AzContext, AzureRmContext, AzureCredential |
Parameter sets
-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.
Parameter properties
| Type: | SwitchParameter |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-KBNumberToExclude
KBs to exclude in the patch operation. This parameter is only available for Windows VM.
Parameter properties
| Type: | String[] |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-KBNumberToInclude
KBs to include in the patch operation. This parameter is only available for Windows VM.
Parameter properties
| Type: | String[] |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-Linux
For Linux VM
Parameter properties
| Type: | SwitchParameter |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-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).
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-PackageNameMaskToExclude
Packages to exclude in the patch operation. Format: packageName_packageVersion. This parameter is only available for Linux VM.
Parameter properties
| Type: | String[] |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-PackageNameMaskToInclude
Packages to include in the patch operation. Format: packageName_packageVersion. This parameter is only available for Linux VM.
Parameter properties
| Type: | String[] |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-RebootSetting
Defines when it is acceptable to reboot a VM during a software update operation.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-ResourceGroupName
The resource group name.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-ResourceId
Resource ID for your virtual machine.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-VM
PowerShell Virtual Machine Object
Parameter properties
| Type: | PSVirtualMachine |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
| Aliases: | VMProfile |
Parameter sets
-VMName
Virtual Machine name
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
| Aliases: | Name |
Parameter sets
-WhatIf
Shows what would happen if the cmdlet runs. The cmdlet is not run.
Parameter properties
| Type: | SwitchParameter |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
| Aliases: | wi |
Parameter sets
-Windows
For Windows VM
Parameter properties
| Type: | SwitchParameter |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
Inputs
String
PSVirtualMachine
Outputs
PSVirtualMachineInstallPatchesResult
Azure PowerShell
Feedback
Was this page helpful?
