PaulDotCom mailing list archives

Drive letter from volume name


From: j2mccluggage at adelphia.net (Jody & Jennifer McCluggage)
Date: Sun, 14 Mar 2010 11:22:28 -0400

Yes, Windows PowerShell is only installed by default on Windows 7 and 2008
Server R2.  Although it is getting more and more popular and can be
installed on XP and later machines, you might not want to assume that it is
installed. Cmd.exe will be present on all systems.

 

As an aside, if PowerShell is present, a  real simple command to run to just
see what drives are accessible (includes mapped drives) is:   get-psdrive
-PSProvider Filesystem .   It is not as granular as WMI but does give you a
quick and dirty way of seeing which drives are available on the local
system.

 

Jody

 

From: pauldotcom-bounces at mail.pauldotcom.com
[mailto:pauldotcom-bounces at mail.pauldotcom.com] On Behalf Of Adrian Crenshaw
Sent: Friday, March 12, 2010 2:02 PM
To: PaulDotCom Security Weekly Mailing List
Subject: Re: [Pauldotcom] Drive letter from volume name

 

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/20100314/0fdb05b5/attachment.htm 


Current thread: