Functions/Confirm-UnspecifiedParameter.ps1
function Confirm-UnspecifiedParameter { [CmdletBinding(SupportsShouldProcess)]param() if(!$tenants -or !$subscriptions -or !$sections -or !$outputs){ $missingParameters = ""; if(!$tenants){ $missingParameters += " tenants " } if(!$subscriptions){ $missingParameters += " subscriptions " } if(!$sections){ $missingParameters += " sections " } if(!$subscriptions){ $missingParameters += " outputs " } $confirmationTitle = "Unspecified parameters found: $missingParameters"; $confirmationMessage = "Any parameters that are not specified will process all available items under your credentials by default, this may result in a long running process. For help/examples on available parameters please use the 'Get-Help Start-CloudScan -detailed' CmdLet. Confirm if you would like to continue?"; $ConfirmPreference = "Low" If (!$PSCmdlet.ShouldContinue($confirmationMessage, $confirmationTitle)) { Write-Host "Please specify any parameters to filter scan. Exiting application..." -ForegroundColor magenta Break; } } } |