Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable a device without a confirmation - PowerShell

I'm working on a script that automates the process of disabling multiple Devices in Windows 10. This is my attempt:

Get-PnpDevice something | Disable-PnpDevice

That code asks the user to enter y or n to confirm the process of disabling the device.

How to bypass the confirmation prompt to make the script full automatic?

*I always run the script as Administrator.

like image 955
Se7en Avatar asked May 15 '26 10:05

Se7en


1 Answers

If the script uses PowerShell cmdlets, you can specify -Confirm:$false to suppress the prompt.

Get-PnpDevice something | Disable-PnpDevice -Confirm:$false
like image 169
NeoTheNerd Avatar answered May 17 '26 01:05

NeoTheNerd



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!