PaulDotCom mailing list archives

Drive letter from volume name


From: lostpacket at live.com (Norman Rach)
Date: Fri, 12 Mar 2010 10:00:59 -0800


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.
http://clk.atdmt.com/GBL/go/210850552/direct/01/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.pauldotcom.com/pipermail/pauldotcom/attachments/20100312/74ff1afe/attachment.htm 


Current thread: