Solved

find usb drive with WMI cmd using drivetype 2

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

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Internet Explorer 11.0 fails to open 34 85
802.1x and RDP Issues 6 74
Windows 7 - BSOD associated with video driver 34 51
powershell event viewer 1 18
Ever notice how you can't use a new drive in Windows without having Windows assigning a Disk Signature?  Ever have a signature collision problem (especially with Virtual Machines?)  This article is intended to help you understand what's going on and…
The recent Microsoft changes on update philosophy for Windows pre-10 and their impact on existing WSUS implementations.
The viewer will learn how to successfully download and install the SARDU utility on Windows 7, without downloading adware.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

735 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