MooglePower Posted July 9, 2010 Share Posted July 9, 2010 I'm writing a script in which drives need to be mapped consistently to the same letter. Currently, my script will just return an error if I run it when something else is mapped, but I want to be able to have my program unmount any drive that may be mounted to that particular letter.I know that there's the DriveMapDel function, but it only unmounts networked drives. Is there a way to unmount everything with that particular letter? Link to comment Share on other sites More sharing options...
Developers Jos Posted July 9, 2010 Developers Share Posted July 9, 2010 Don't see how you can Unmount a drive that was never mounted in the first place. The fixed drive letters and USB drive letters are assigned in the DiskManager which you can find in the Controlpanel. Is that what you would want to change? SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
MooglePower Posted July 9, 2010 Author Share Posted July 9, 2010 The drive would have been mounted when the end user plugged it into his computer, but it wouldn't have been mounted by the script.Yes, system administrators have access to Disk Manager, but end users don't. I'm writing the script for an environment in which users do not have privileges (or the knowledge required) to go into Disk Manager and change the drive letters manually. That's why I have to script the unmount of any drives currently mounted on the desired drive letter before I go ahead and mount the network share that I need to mount.Don't see how you can Unmount a drive that was never mounted in the first place.The fixed drive letters and USB drive letters are assigned in the DiskManager which you can find in the Controlpanel.Is that what you would want to change? Link to comment Share on other sites More sharing options...
MooglePower Posted July 9, 2010 Author Share Posted July 9, 2010 If there's a way to change drive letters for pre-existing drives, that would work, too. Link to comment Share on other sites More sharing options...
Developers Jos Posted July 9, 2010 Developers Share Posted July 9, 2010 (edited) Never done this but a quick google turned up this vbscript which should be pretty easy to convert to AutoIt3 code: strComputer = "." Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2") Set colVolumes = objWMIService.ExecQuery _ ("Select * from Win32_Volume Where Name = 'D:\\'") For Each objVolume in colVolumes objVolume.DriveLetter = "Q:" objVolume.Put_ Next Some other nice code there: http://www.activexperts.com/activmonitor/windowsmanagement/adminscripts/disk/drives Edited July 9, 2010 by Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now