Add-PackageUpdateRule
For AI agents: a documentation index is available at /llms.txt; a markdown version of this page is available at /docs/commands/add-packageupdaterule/index.md.
SYNOPSIS
Adds a custom rule that controls how module updates are reported.
SYNTAX
__AllParameterSets
Add-PackageUpdateRule [[-Id] <int>] [[-IncludeModuleForChecking] <string[]>]
[[-ExcludeModuleFromChecking] <string[]>] [[-ReportChangeOnMajor] <bool>]
[[-ReportChangeOnMinor] <bool>] [[-ReportChangeOnBuild] <bool>] [[-ReportChangeOnRevision] <bool>]
[[-SettingObject] <Configuration>] [-PassThru] [-WhatIf] [-Confirm] [<CommonParameters>]
ALIASES
This cmdlet has the following aliases,
DESCRIPTION
This command creates a custom update rule for the current PackageUpdateInfo configuration. Each rule defines when an update should be considered relevant for reporting based on changes in the major, minor, build, or revision portion of a module version. Rules can also scope reporting to specific modules by including or excluding module names, which makes it possible to suppress noisy revision-only updates or focus checks on selected modules. If no settings object is provided, the command uses the current module configuration and stores the new rule there.
EXAMPLES
EXAMPLE 1
PS C:\> Add-PackageUpdateRule -IncludeModuleForChecking "MyModule" -ReportChangeOnMajor $true -ReportChangeOnMinor $true -ReportChangeOnBuild $true -ReportChangeOnRevision $false
Adds a rule that reports major, minor, and build updates for MyModule while suppressing revision-only changes.
EXAMPLE 2
PS C:\> Add-PackageUpdateRule -ExcludeModuleFromChecking "PowerShellGet","PSScriptAnalyzer" -ReportChangeOnRevision $false
Adds a rule that excludes two modules from update checking and suppresses revision updates for the remaining modules.
EXAMPLE 3
PS C:\> Add-PackageUpdateRule -Id 99 -IncludeModuleForChecking "MyModule" -PassThru
Adds a rule with a specific identifier and returns the created rule object.
EXAMPLE 4
PS C:\> $settings = Get-PackageUpdateSetting; Add-PackageUpdateRule -SettingObject $settings -ExcludeModuleFromChecking "MyModule"
Adds a rule to an existing settings object without using the default module configuration.
PARAMETERS
-Confirm
Prompts for confirmation before saving the new rule.
Type: SwitchParameter
DefaultValue: ''
SupportsWildcards: false
Aliases:
- cf
ParameterSets:
- Name: (All)
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-ExcludeModuleFromChecking
One or more module names that should be excluded from update checking by this rule.
Type: String[]
DefaultValue: ''
SupportsWildcards: false
Aliases:
- Exclude
- ExcludeModule
ParameterSets:
- Name: (All)
Position: 2
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-Id
The unique identifier for the rule.
Type: Int32
DefaultValue: 0
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: 0
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-IncludeModuleForChecking
One or more module names that should be included in update checking by this rule. If omitted, the rule applies to all modules.
Type: String[]
DefaultValue: ''
SupportsWildcards: false
Aliases:
- Include
- IncludeModule
ParameterSets:
- Name: (All)
Position: 1
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-PassThru
Returns the created rule object from the pipeline.
Type: SwitchParameter
DefaultValue: False
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-ReportChangeOnBuild
Indicates whether a change in the build version part should trigger an update report.
This means ‘Get-PackageUpdateSetting’ will report an update only when the build version of a module changes. Major Minor Build Revision
0 0 1 0
Type: Boolean
DefaultValue: True
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: 5
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-ReportChangeOnMajor
Indicates whether a change in the major version part should trigger an update report.
This means ‘Get-PackageUpdateSetting’ will report an update only when the major version of a module changes.
Major Minor Build Revision
1 0 0 0
Type: Boolean
DefaultValue: True
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: 3
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-ReportChangeOnMinor
Indicates whether a change in the minor version part should trigger an update report.
This means ‘Get-PackageUpdateSetting’ will report an update only when the minor version of a module changes.
Major Minor Build Revision
0 1 0 0
Type: Boolean
DefaultValue: True
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: 4
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-ReportChangeOnRevision
Indicates whether a change in the revision version part should trigger an update report.
This means ‘Get-PackageUpdateSetting’ report update need, when the revision version of a module change.
Major Minor Build Revision
1 0 0 0
Type: Boolean
DefaultValue: True
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: 6
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-SettingObject
A settings object from Get-PackageUpdateSetting that should receive the new rule. If omitted, the current module settings are used.
Type: Configuration
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: 7
IsRequired: false
ValueFromPipeline: true
ValueFromPipelineByPropertyName: true
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-WhatIf
Displays what would happen if the command were to run without changing any configuration.
Type: SwitchParameter
DefaultValue: ''
SupportsWildcards: false
Aliases:
- wi
ParameterSets:
- Name: (All)
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
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
PackageUpdate.Configuration
OUTPUTS
PackageUpdate.ModuleRule
NOTES
Version : 1.1.0.0 Author : Andi Bellstedt Date : 2026-06-21 Keywords : PackageUpdateInfo, Update, Module, Rule