Microsoft Virtualization Discussions

Invoke-NaSnapmirrorBreak without prompting

hollandwl
3,244 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
3,245 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
3,245 Views

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

cknight
3,246 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
3,245 Views

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

Public