Solved

find usb drive with WMI cmd using drivetype 2

Posted on 2014-10-30
2
364 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
  • 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
By default the complete memory dump option is disabled in windows . If we want to enable the complete memory dump for a diagnostic purpose, we have a solution for it. here we are using the registry method to enable this.
This Micro Tutorial will go in depth within Systems and Security in Windows 7 and will go into detail regarding Action Center, Windows Firewall, System, etc. This will be demonstrated using Windows 7 operating system.
The Task Scheduler is a powerful tool that is built into Windows. It allows you to schedule tasks (actions) on a recurring basis, such as hourly, daily, weekly, monthly, at log on, at startup, on idle, etc. This video Micro Tutorial is a brief intro…

910 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now