Sign in to follow this  
Followers 0
turtle342

Disable/Enable Hardware (SCSI Drive)

7 posts in this topic

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

Share this post


Link to post
Share on other sites



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!

Share this post


Link to post
Share on other sites
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!

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

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

What do you want? Power to the device is turned on and the disc is still spinning.

Device_off_on

Edited by AZJIO

Share this post


Link to post
Share on other sites

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!

Share this post


Link to post
Share on other sites

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
Sign in to follow this  
Followers 0