Show-ConsoleChanges
Shows the changes an action would make and asks before making them: the what-if pattern.
Syntax
Show-ConsoleChanges [-After] <Object[]> [-Before] <Object[]> [-Force] [-Ignore <String[]>] [-Property <String[]>] [-Question <String>] [-Title <Object>] [-TypedConfirmation <String>] [-View <Full|Summary|Table|SideBySide|Unified>] [<CommonParameters>]#All Parameter SetsDescription
Shows the changes an action would make and asks before making them: the what-if pattern.
Compares -Before with -After (as Compare-ConsoleObject does), shows the preview, then asks for confirmation and returns $true or $false; act only on $true. Changes that remove objects need the number of removals typed (or the -TypedConfirmation text). It honours the caller's -WhatIf: the preview is shown and $false returned without asking. -Force (or -Confirm:$false) skips the question and returns $true when there are changes. Use it inside your own functions: if (Show-ConsoleChanges -Before $current -After $planned -Property Name) { apply }.
Examples
EXAMPLE 1
Show-ConsoleChanges -Before @('Value') -After @('Value')Parameters
- -After Object[]
- The objects after the change.
- -Before Object[]
- The current objects.
- -Force SwitchParameter
- Skips the question and returns $true when there are changes.
- -Ignore String[]
- Properties or paths left out of the comparison.
- -Property String[]
- The properties that identify an object (matching key).
- -Question String
- The question (default "Apply these changes?").
- -Title Object
- A title (markup).
- -TypedConfirmation String
- Text that must be typed to confirm (for example the name of what is changed).
- -View ChangeViewMode
- The view of the preview: Full (default), Summary, Table, SideBySide or Unified.
- Possible values:
Full,Summary,Table,SideBySide,Unified
Common Parameters
This command supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable.
For more information, see about_CommonParameters.