Microsoft Virtualization Discussions

Invoke-NaSnapmirrorBreak without prompting

hollandwl
4,476 Views

When I use the Invoke-SnapmirrorBreak cmdlet, I am prompted to enter Y, A, N, L, S, or ? to confirm or reject this operation.  I don't want to be prompted, I simply want it to perform the operation.  I've tried using the -Confirm parameter but I get the same results.  If I respond to the prompts, it performs the desired action.  However, I am creating scripts that will be run as part of an automated process with no user available to provide input.

Any ideas?

1 ACCEPTED SOLUTION

cknight
4,477 Views

You can also pass -Confirm:$false to any cmdlet to disable prompts only for its invocation.  PowerShell's default value of $ConfirmPreference is "High".  Most confirmations in the Toolkit are "Low" or "Medium", primarily reserving "High" for those that impact data such as removing LUNs, Volumes, etc.

View solution in original post

3 REPLIES 3

hollandwl
4,477 Views

I found the solution.  I did $ConfirmPreference = "None" at the beginning of the script and it removed the prompts.

cknight
4,478 Views

You can also pass -Confirm:$false to any cmdlet to disable prompts only for its invocation.  PowerShell's default value of $ConfirmPreference is "High".  Most confirmations in the Toolkit are "Low" or "Medium", primarily reserving "High" for those that impact data such as removing LUNs, Volumes, etc.

hollandwl
4,477 Views

Thanks.  I'm still new to Powershell, so a lot to learn yet.

Public