none
Powershell Auto Confirmation RRS feed

  • Question

  • Hi I want to script the stopping of Windows Failover cluster but can't seem to get it to auto confirm. I've tried using -Confirm:$false but that doesn't seem to help and I still get asked to confirm

    Stop-Cluster -Name cluster.domain.com -Confirm:$false

     Stop-Cluster
    Are you sure you want to stop the cluster cluster.domain.com?
    [Y] Yes  [N] No  [S] Suspend  [?] Help (default is "Y"):

    Is there a way I can achieve this

    • Moved by Bill_Stewart Friday, January 26, 2018 3:03 PM This is not "troubleshoot stuff for me" forum
    Monday, December 4, 2017 1:59 PM

All replies

  • Use -Force instead:

    Stop-Cluster -Name cluster.domain.com -Force

    The documentation on Stop-Cluster shows that -Confirm is a switch parameter which will prompt the user to confirm the change. -Force will force the command to run without user confirmation.

    https://docs.microsoft.com/en-us/powershell/module/failoverclusters/stop-cluster?view=win10-ps


    Jeremy Corbello | https://www.jeremycorbello.com


    • Edited by Jacorbello Monday, December 4, 2017 2:10 PM Added source
    Monday, December 4, 2017 2:09 PM
  • Hi Jeremy, same issue

    PS C:\Users\administrator.DOMAIN> Stop-Cluster -Name cluster.domain.com -Force

    Confirm
    Are you sure you want to perform this action?


    Monday, December 4, 2017 2:18 PM
  • That's odd. I just tried it in my lab environment just to be sure and it worked as expected - no prompt, just killed the Cluster service.


    Jeremy Corbello | https://www.jeremycorbello.com

    Monday, December 4, 2017 2:39 PM