PaulDotCom mailing list archives

Drive letter from volume name


From: irongeek at irongeek.com (Adrian Crenshaw)
Date: Fri, 12 Mar 2010 15:32:07 -0500

Crap, just noticed the one Tim sent does not base it on volume name.

Adrian

On Fri, Mar 12, 2010 at 2:02 PM, Adrian Crenshaw <irongeek at irongeek.com>wrote:

I can't be sure Powershell is on the system.  Tim Medin gave me s slightly
different version of this, which works:

cmd /c for /F %i in ('WMIC logicaldisk where "DriveType=2" list brief ^|
find ":"') do %i\myscript.bat


Thanks,
Adrian


On Fri, Mar 12, 2010 at 1:00 PM, Norman Rach <lostpacket at live.com> wrote:

 Here's the powershell option:

Get-WmiObject Win32_LogicalDisk | Where-Object {$_.drivetype -eq 2} | fl *

If you know the VolumeSerialNumber, you can just alter the script:

Get-WmiObject Win32_LogicalDisk | Where-Object {$_.VolumeSerialNumber -eq
<whatever>} | fl *


If you want to leverage the native os, there's vbscript.  I'm a little
rusty but it will probably look similar to this:

Set objWMIService = GetObject ("winmgmts:\\" & strComputer &
"\root\cimv2")
Set colItems = objWMIService.ExecQuery ("Select * from Win32_LogicalDisk
where DriveType=2")

Thanks!

------------------------------
Hotmail: Trusted email with Microsoft?s powerful SPAM protection. Sign up
now. <http://clk.atdmt.com/GBL/go/210850552/direct/01/>

_______________________________________________
Pauldotcom mailing list
Pauldotcom at mail.pauldotcom.com
http://mail.pauldotcom.com/cgi-bin/mailman/listinfo/pauldotcom
Main Web Site: http://pauldotcom.com



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.pauldotcom.com/pipermail/pauldotcom/attachments/20100312/ade3606e/attachment.htm 


Current thread: