无需确认即可禁用设备 - PowerShell

Se7*_*7en 6 windows powershell

我正在编写一个脚本,该脚本可以自动执行在 Windows 10 中禁用多个设备的过程。这是我的尝试:

Get-PnpDevice something | Disable-PnpDevice
Run Code Online (Sandbox Code Playgroud)

该代码要求用户输入yn确认禁用设备的过程。

如何绕过确认提示使脚本全自动?

*我总是以管理员身份运行脚本。

小智 10

如果脚本使用 PowerShell cmdlet,您可以指定 -Confirm :$false来抑制提示。

Get-PnpDevice something | Disable-PnpDevice -Confirm:$false
Run Code Online (Sandbox Code Playgroud)