Skip to content

[Feature Request] Add an Official Way to Bypass Confirmation in Get-Confirmation #648

Description

@Mohammed-Eltaweel

Description

While automating One Identity Safeguard deployments using the safeguard-ps PowerShell module, I encountered an issue where confirmation prompts prevent unattended execution when trying to set the time of the safegaurd using Set-SafeguardTime

The confirmation logic is implemented in Modules/ps-utilities.psm1 within the Get-Confirmation function.

The function always prompts the user for input by calling:
$host.UI.PromptForChoice(...)

This makes it impossible to run deployment scripts non-interactively.

Current Workaround

To allow unattended execution, I currently patch ps-utilities.psm1 after installing the module by adding the following check inside Get-Confirmation before the confirmation prompt is displayed:
if ($env:SAFEGUARD_NO_CONFIRM -eq "1") { return $true }

Then, before executing my deployment scripts, I simply set:
$env:SAFEGUARD_NO_CONFIRM = "1"

This allows the scripts to complete without user interaction.

Why This Is a Problem

Although the workaround functions correctly, it requires modifying the module's source code.

As a result:

  • Every module update overwrites the modification.
  • Deployment automation must patch the module before execution.
  • Maintaining a custom version of the module is undesirable.

Suggested Enhancement

It would be helpful if the module provided an official mechanism to bypass confirmation prompts, for example:

  • Support for an environment variable (such as SAFEGUARD_NO_CONFIRM).
  • A module-wide non-interactive mode.
  • Support for -Confirm:$false or -Force where appropriate.
  • Any other officially supported mechanism that avoids modifying the module.

This would preserve the current behavior for interactive users while enabling unattended deployment scenarios.

Environment

Safeguard PowerShell Module: safeguard-ps
Use case: Automated One Identity Safeguard deployment and configuration using PowerShell
Issue location: Modules/ps-utilities.psm1 (Get-Confirmation function)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions