RE: Identify mapped drives on a workstation

Tech-Archive recommends: Speed Up your PC by fixing your registry



Answered my own question; (scriptomatic is our friend)

On Error Resume Next

Const wbemFlagReturnImmediately = &h10
Const wbemFlagForwardOnly = &h20

arrComputers = Array("Computer NAME HERE")
For Each strComputer In arrComputers
WScript.Echo
WScript.Echo "=========================================="
WScript.Echo "Computer: " & strComputer
WScript.Echo "=========================================="

Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_LogicalDisk",
"WQL", _
wbemFlagReturnImmediately +
wbemFlagForwardOnly)

For Each objItem In colItems
WScript.Echo "Caption: " & objItem.Caption
WScript.Echo "DriveType: " & objItem.DriveType
WScript.Echo "FreeSpace: " & objItem.FreeSpace
WScript.Echo "MediaType: " & objItem.MediaType
WScript.Echo "Name: " & objItem.Name
WScript.Echo "ProviderName: " & objItem.ProviderName
WScript.Echo "Size: " & objItem.Size
WScript.Echo "Status: " & objItem.Status
WScript.Echo "VolumeName: " & objItem.VolumeName
WScript.Echo
Next
Next


Function WMIDateStringToDate(dtmDate)
WScript.Echo dtm:
WMIDateStringToDate = CDate(Mid(dtmDate, 5, 2) & "/" & _
Mid(dtmDate, 7, 2) & "/" & Left(dtmDate, 4) _
& " " & Mid (dtmDate, 9, 2) & ":" & Mid(dtmDate, 11, 2) & ":" &
Mid(dtmDate,13, 2))
End Function


"MFelkins" wrote:

> Hi,
>
> Is it possible to querry a workstation to see what the drive mappings ar for
> the current user. I am moving some folders from one server to another and I
> would like to see how my customers have their current drives mapped so that I
> can help them repoint their mappings.
>
>
> M - sorry if that does not make good gramatical sence.
.



Relevant Pages

  • Re: WMI slow
    ... Const wbemFlagReturnImmediately = &h10 ... Const wbemFlagForwardOnly = &h20 ... For Each strComputer In arrComputers ... Set colItems = objWMIService.ExecQuery("SELECT * FROM ...
    (microsoft.public.scripting.vbscript)
  • How do you call a method?
    ... I am writting ascrit that uses the following; ... Const wbemFlagReturnImmediately = &h10 ... Const wbemFlagForwardOnly = &h20 ... For Each strComputer In arrComputers ...
    (microsoft.public.scripting.vbscript)
  • Is there a way to output this information and create an html form
    ... Is there a way to output this information and create an html form ... Const wbemFlagReturnImmediately = &h10 ... For Each strComputer In arrComputers ... Prev by Date: ...
    (microsoft.public.scripting.wsh)
  • Counting items in a collection
    ... Const wbemFlagForwardOnly = &h20 ... For Each strComputer In arrComputers ... Set colItems = objWMIService.ExecQuery("SELECT Name, ...
    (microsoft.public.windows.server.scripting)
  • Re: How to logon to computers?
    ... Const wbemFlagForwardOnly = &h20 ... For Each strComputer In arrComputers ... Set colItems = objWMIService.ExecQuery("SELECT * FROM ... > what if the user is domain admin? ...
    (microsoft.public.windows.server.scripting)