Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

find usb drive with WMI cmd using drivetype 2

Posted on 2014-10-30
2
Medium Priority
?
397 Views
Last Modified: 2014-10-31
ok i need a hand on this i am trying to get a cmd that will find the usb thumb drive in any computer i plug it in to.

The usb drive in a winpe with 2 partitions.

partitions 1  is the winpe
partitions 2 is the images

It's also bitlocked

i have this script i found the file name is unlock

@echo off & cls

set Volume=%1:

echo.

manage-bde.exe -unlock -password %Volume%

echo. & pause & echo.

:: End of script

Open in new window


to run it i just unlock d

the D drive would be the bitlocked usb drive. It would ask for the password i enter it in and it unlocks it for me.

That's great after it unlock i want it to launch a hta file on the unlocked usb drive.


What i need help with is HOW do i find the usb drive letter and have it run the command unlock "drive letter it finds"

I always what it to prompt for the password i type it in and them it opens the hta file on the usb drive
0
Comment
Question by:armasmike
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 

Author Comment

by:armasmike
ID: 40416079
this is what i have so far

strComputer = "."
Set oShell = WScript.CreateObject ("WScript.shell") 
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colDisks = objWMIService.ExecQuery ("SELECT * FROM Win32_LogicalDisk")

For Each objDisk in colDisks
 
 Select Case objDisk.DriveType

 Case 2

Wscript.Echo "DeviceID: "& objDisk.DeviceID & " Removable drive."
 
 
  oShell.run "manage-bde.exe -unlock -password " & "objDisk.DeviceID"
 
 End Select
Next

Open in new window


is not quite working what am i missing ?
0
 

Accepted Solution

by:
armasmike earned 0 total points
ID: 40416084
well looks like i got it working

i used this as the run command

oShell.run "cmd /K manage-bde.exe -unlock -password " & objDisk.DeviceID

Open in new window


and it works i enter the password and drive is unlocked.
0

Featured Post

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

OfficeMate Freezes on login or does not load after login credentials are input.
On some Windows 7 (SP1) computers, Windows Update becomes super slow even the computer is reasonably fast.  There's one solution that seemed to have worked well for me (after trying a few other suggested solutions).
This Micro Tutorial will teach you how to change your appearance and customize your Windows 7 interface to your unique preference. This will be demonstrated using Windows 7 operating system.
The viewer will learn how to successfully download and install the SARDU utility on Windows 7, without downloading adware.

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question