Another solution
On Error Resume Next
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from
Win32_MappedLogicalDisk")
For Each objItem in colItems
WScript.Echo "Drive: " & objItem.Name & ", server share: " &
objItem.ProviderName
Next
This gives output similiar to below:
Drive: M:, server share: \\server1\share1
Drive: N:, server share: \\server1\share2
Drive: P:, server share: \\server1\_home$\user1
Drive: Q:, server share: \\server1\share4
Drive: S:, server share: \\server1\share5
Drive: Z:, server share: \\software01\it_stuff
Regards
Tony Patton
Desktop Operations Cavan
Ext 8078
Direct Dial 049 435 2878
email: [email protected]
René de Haas <[email protected]>
20/03/2009 16:29
Please respond to
"NT System Admin Issues" <[email protected]>
To
"NT System Admin Issues" <[email protected]>
cc
Subject
RE: Scrip Help please?
First you get all mappings with wshNetwork.EnumNetworkDrives then check
them
Trick is index 0,2,4 etc are driveletters
Index 1,3,5 etc are the mappings
You could do something like this:
Option Explicit
Dim wshNetwork
Dim maps
Dim i
Set wshNetwork = CreateObject("Wscript.network")
Set maps=wshNetwork.EnumNetworkDrives
for i=0 to maps.Length-2 step 2
Next
Hth
Reÿé
From: Steve Kelsay [mailto:[email protected]]
Sent: Friday, March 20, 2009 5:19 PM
To: NT System Admin Issues
Subject: Scrip Help please?
I am looking for help writing a VBScript to
1. Detect whether a specified mapped drive exists
2. If so, retrieve the target mapping (if the X: drive is not mapped
to \\server\share, then map it )
I have Googled and found lots of stuff, but nothing that does this. I can
retrieve the drive letter and see if it exists, but where it is mapped to
is eluding me.
It has to be simple.
***
The information in this e-mail is confidential and intended solely for the
individual or entity to whom it is addressed. If you have received this
e-mail in error please notify the sender by return e-mail delete this
e-mail and refrain from any disclosure or action based on the information.
***
====================================================================
http://www.quinn-insurance.com
This e-mail is intended only for the addressee named above. The contents
should not be copied nor disclosed to any other person. Any views or
opinions expressed are solely those of the sender and
do not necessarily represent those of QUINN-Insurance, unless otherwise
specifically stated . As internet communications are not secure,
QUINN-Insurance is not responsible for the contents of this message nor
responsible for any change made to this message after it was sent by the
original sender. Although virus scanning is used on all inbound and
outbound e-mail, we advise you to carry out your own virus check before
opening any attachment. We cannot accept liability for any damage sustained
as a result of any software viruses.
====================================================================
QUINN-Life Direct Limited is regulated by the Financial Regulator.
QUINN-Insurance Limited is regulated by the Financial Regulator and
regulated by the Financial Services Authority for the conduct of UK
business.
====================================================================
QUINN-Life Direct Limited is registered in Ireland, registration number
292374 and is a private company limited by shares.
QUINN-Insurance Limited is registered in Ireland, registration number
240768 and is a private company limited by shares.
Both companies have their head office at Dublin Road, Cavan, Co. Cavan.
~ Finally, powerful endpoint security that ISN'T a resource hog! ~
~ <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/> ~