Jump to content

Recommended Posts

Posted

Hey guys, I've been using AutoIT for a few months now, mainly for automating some disk drive tests. My question is I'm struggling to find a way to Enable and Disable hardware, mainly a SCSI drive, to perform some benchmarking. I've used WMIC a fair amount in my scripting so far but from what I've found out, disabling hardware doesn't fall under WMIC scope

This may have been asked a fair few times, and no I don't need automation to install drivers for me, just Disable / Enable the drive, possible uninstall and reinstall (without removal of drivers) and also Online/Offline the drive. 

Anyone got any experience in this area??

Cheers,

Martin

Posted

Ok, I've found out we can do Online / Offline using DiskPart, so thats at least one step covered! Any thoughts on Disable/Enable and Uninstall/Reinstall welcome!

Posted
Func _RemoveLetter($sDrive)
    $sPath = @TempDir & '\dismount_hdd.txt'
    $hFile = FileOpen($sPath, 2)
    FileWrite($hFile, 'select volume ' & $sDrive & @CRLF & 'remove letter=' & $sDrive)
    FileClose($hFile)
    RunWait(@SystemDir & '\DiskPart /s ' & $sPath, '', @SW_HIDE)
EndFunc   ;==>_RemoveLetter

This will remove the drive letter but not Disable the device, or Uninstall it! 

 

And I'll look into this! Cheers JLogan!

Posted

Maybe you mis-understand, I need to automate disabling the device as you would via Device manager, so I can check enumeration and duration (amongst other things) when it's enabled again, I will check out Device_off_on (whatever it is) when I'm back at home!

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...