microsoft:scripting:vbscript:scripts:wmi-setopticaldriveletter
Version 1
Assumes C and D are local hard drives/partitions and E is the optical drive.
'WMI-SetOpticalDriveLetter.vbs 'For moving the optical drive of the local machine. 'Contains code from http://www.visualbasicscript.com/tm.aspx?high=&m=30133&mpage=1. '20110701, v1. strComputer = "." Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") 'Select all volumes of type compact disc. 'http://msdn.microsoft.com/en-us/library/aa394515(v=VS.85).aspx - Win32_Volume Class. Set colVolumes = objWMIService.ExecQuery ("SELECT * FROM Win32_Volume WHERE DriveType = 5") For Each vol in colVolumes If vol.DriveLetter = "E:" Then vol.DriveLetter = "X:" vol.Put_ End If Next Set colVolumes = Nothing Set objWMIService = Nothing
microsoft/scripting/vbscript/scripts/wmi-setopticaldriveletter.txt · Last modified: 2012/02/10 09:00 by bas