Skip to main content
Question

How do I create a worklet to Enable USB Ports?


dylan
Forum|alt.badge.img

Hi everyone,

I'm currently using the following PowerShell script to disable USB storage devices and enable mouse and keyboard devices:

# Disable USB storage devices
$usbDevices = Get-PnpDevice -Class "USB" -Status OK | Where-Object {$_.Service -eq "USBSTOR"}
foreach ($usbDevice in $usbDevices) {
    Disable-PnpDevice -InstanceId $usbDevice.InstanceId -Confirm:$false
}

# Enable mouse and keyboard devices
$mouseDevice = Get-PnpDevice -Class "Mouse" -Status OK | Where-Object {$_.ConfigManagerErrorCode -eq 0}
$keyboardDevice = Get-PnpDevice -Class "Keyboard" -Status OK | Where-Object {$_.ConfigManagerErrorCode -eq 0}
Enable-PnpDevice -InstanceId $mouseDevice.InstanceId -Confirm:$false
Enable-PnpDevice -InstanceId $keyboardDevice.InstanceId -Confirm:$false

# Evaluation code
Write-Output "This code disables USB storage devices and enables mouse and keyboard devices."

However, I need to find an Automox worklet that enables USB drives. Can anyone help me find a worklet that does this?

0 replies

Be the first to reply!

Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings