When I run
But when I run the script (for example, cron), I do not want any interactive and pause on this team.
I would want that the command returned an error or does not return anything (and later deal with the result of the command), but does not stop the execution of waiting for a input in the console.
And I want an answer "No" to such a request (-Force I understand it gives the answer is always Yes).
Stop-VM -Name "VMNAME" -confirm:$falseI receive prompt for confirmation:
Confirm Hyper-V cannot shut down virtual machine VMNAME because the Shutdown integration service is unavailable. To avoid potential data loss, you can pause or save the state of the virtual machine. The other option is to turn off the virtual machine, but data loss might occur. [Y] Yes [N] No [S] Suspend [?] Help (default is "Y"): N
But when I run the script (for example, cron), I do not want any interactive and pause on this team.
I would want that the command returned an error or does not return anything (and later deal with the result of the command), but does not stop the execution of waiting for a input in the console.
And I want an answer "No" to such a request (-Force I understand it gives the answer is always Yes).