Home > Software engineering >  Disable a device without a confirmation - PowerShell
Disable a device without a confirmation - PowerShell

Time:12-04

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.

CodePudding user response:

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

Get-PnpDevice something | Disable-PnpDevice -Confirm:$false
  • Related