Common Parameters in scripts

Product: PowerShell Universal
Version: 3.9.19

I have a script that has SupportsShouldProcess so I can leverage the common param -Whatif

If you try and run that script from the UI you do not get the option to use the common params. Does anyone else do this?

I suppose I could do something like this?

[CmdletBinding(SupportsShouldProcess)]
param(
    [Parameter(HelpMessage = "If true, it will show that the script will do")]
    [bool]
    $WhatIfPreference,

    $VerbosePreference,

    [Parameter(Mandatory = $true, HelpMessage = "")]
    [string] 
    $UserAccount,
)
1 Like