Set-PackageUpdateRule

For AI agents: a documentation index is available at /llms.txt; a markdown version of this page is available at /docs/commands/set-packageupdaterule/index.md.

SYNOPSIS

Updates an existing PackageUpdateInfo rule that controls how module version changes are reported.

SYNTAX

ById (Default)

Set-PackageUpdateRule -Id <int> [-IncludeModuleForChecking <string[]>]
 [-ExcludeModuleFromChecking <string[]>] [-ReportChangeOnMajor <bool>] [-ReportChangeOnMinor <bool>]
 [-ReportChangeOnBuild <bool>] [-ReportChangeOnRevision <bool>] [-SettingObject <Configuration>]
 [-PassThru] [-WhatIf] [-Confirm] [<CommonParameters>]

ByInputObject

Set-PackageUpdateRule -InputObject <ModuleRule[]> [-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 cmdlet modifies an existing update rule stored in the PackageUpdateInfo configuration so that update checks can be narrowed or expanded for specific modules. You can use it to include or exclude modules from update detection, control which version parts trigger an update report, and persist those rule changes back to the active settings file. The command works with a rule identified by Id or with a rule object supplied through InputObject, and it can return the updated rule when -PassThru is specified.

EXAMPLES

EXAMPLE 1

PS C:\> Set-PackageUpdateRule -Id 3 -IncludeModuleForChecking 'MyModule' -ReportChangeOnMajor $true -ReportChangeOnMinor $true -ReportChangeOnBuild $true -ReportChangeOnRevision $false -PassThru

Updates rule 3 so that MyModule is evaluated explicitly and only major, minor, and build changes are reported as update needs.

EXAMPLE 2

PS C:\> Get-PackageUpdateRule -Id 7 | Set-PackageUpdateRule -ExcludeModuleFromChecking 'AzureTools' -ReportChangeOnRevision $false

Takes the rule with Id 7 from the pipeline and suppresses revision-based update reporting for AzureTools while keeping the rule stored in the current settings.

EXAMPLE 3

$rule = Get-PackageUpdateRule -Id 12
PS C:\> Set-PackageUpdateRule -InputObject $rule -IncludeModuleForChecking 'PowershellGet','PSReadLine' -ReportChangeOnMinor $false -ReportChangeOnBuild $false

Loads an existing rule object, expands the included modules, and updates the rule so that only major and revision changes are treated as actionable updates.

EXAMPLE 4

PS C:\> Set-PackageUpdateRule -Id 5 -ReportChangeOnMajor $false -ReportChangeOnMinor $false -ReportChangeOnBuild $false -ReportChangeOnRevision $true -WhatIf

Shows the effect of changing rule 5 to report only revision-based updates without actually writing the change to disk.

PARAMETERS

-Confirm

Prompts for confirmation before the cmdlet writes changed rule data back to the settings file.

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 checks for the rule being changed.

Type: String[]
DefaultValue: ''
SupportsWildcards: false
Aliases:
- Exclude
- ExcludeModule
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-Id

The numeric identifier of the rule to modify.

Type: Int32
DefaultValue: 0
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: ById
  Position: Named
  IsRequired: true
  ValueFromPipeline: true
  ValueFromPipelineByPropertyName: true
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-IncludeModuleForChecking

One or more module names that should be included in update checks for the rule being changed. When omitted, the rule keeps the default behavior of evaluating all modules.

Type: String[]
DefaultValue: ''
SupportsWildcards: false
Aliases:
- Include
- IncludeModule
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-InputObject

The rule object to update. This is useful when you already have a rule from Get-PackageUpdateRule and want to change it without referring to its Id.

Type: ModuleRule[]
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: ByInputObject
  Position: Named
  IsRequired: true
  ValueFromPipeline: true
  ValueFromPipelineByPropertyName: true
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-PassThru

Returns the updated rule object to the pipeline after the change has been written to the settings file.

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

Controls whether a change in the build version part causes the rule to report that an update is needed.

Report when build version changed for a module

This means ‘Get-PackageUpdateSetting’ report update need, only when the build version version of a module change.

Major Minor Build Revision


0 0 1 0

Type: Boolean
DefaultValue: False
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-ReportChangeOnMajor

Controls whether a change in the major version part causes the rule to report that an update is needed.

Report when major version changed for a module

This means ‘Get-PackageUpdateSetting’ report update need, only when the major version version of a module change.

Major Minor Build Revision


1 0 0 0

Type: Boolean
DefaultValue: False
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-ReportChangeOnMinor

Controls whether a change in the minor version part causes the rule to report that an update is needed.

Report when minor version changed for a module

This means ‘Get-PackageUpdateSetting’ report update need, only when the minor version version of a module change.

Major Minor Build Revision


0 1 0 0

Type: Boolean
DefaultValue: False
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-ReportChangeOnRevision

Controls whether a change in the revision version part causes the rule to report that an update is needed.

Report when revision part changed for a module

This means ‘Get-PackageUpdateSetting’ report update need, only when the revision version version of a module change.

Major Minor Build Revision


0 0 0 1

Type: Boolean
DefaultValue: False
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-SettingObject

The PackageUpdateInfo configuration object to update. When omitted, the cmdlet uses the current module settings from Get-PackageUpdateSetting.

Type: Configuration
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: true
  ValueFromPipelineByPropertyName: true
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-WhatIf

Shows what would happen if the command were to run without applying any changes.

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

System.Int32

PackageUpdate.ModuleRule[]

PackageUpdate.Configuration

OUTPUTS

PackageUpdate.ModuleRule

NOTES

Version : 1.1.0.0 Author : Andi Bellstedt Date : 2026-06-21 Keywords : PackageUpdateInfo, Update, Module, Rule