Page 1 of 1 1
Topic Options
#27484 - 2002-08-22 08:27 AM Script to check a mapped drive
2LIG Offline
Fresh Scripter

Registered: 2002-08-15
Posts: 5
Does anyone have a script that would check if a particular share is already mapped?
Top
#27485 - 2002-08-22 08:50 AM Re: Script to check a mapped drive
Svein Arild Haugum Offline
Fresh Scripter

Registered: 2002-02-13
Posts: 15
Loc: Oslo, Norway
This is taken a little bit out of its context, but you see the code wich i use to check if there is a networkdrive.

IF $E<>""
? " E: $E"
$ReturnCode=ExistKey ("HKEY_CURRENT_USER\NETWORK\E")
If $ReturnCode=0
SHELL "CMD.EXE /C NET USE E: /D >nul"
ENDIF
USE E: /DEL
USE E: $E
ENDIF

Svein A

Top
#27486 - 2002-08-23 12:42 AM Re: Script to check a mapped drive
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
Lookup WshPipe() UDF in the UDF Library. It is required for this code sample.
code:
Break on
$rc=WshPipe("%comspec% /c net use", 1)
for each $line in $rc
if instr($line, "Servername\share"
? $line + " found"
endif
next
? "Exit Code: " @error " " $WshErrorMsg

_________________________
Home page: http://www.kixhelp.com/hb/

Top
#27487 - 2002-08-23 12:54 AM Re: Script to check a mapped drive
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
unrelated question, hoby...

do you know is there api function to call shell?
like one in wsh but actually windows api which could be used with, say c++...
_________________________
!

download KiXnet

Top
#27488 - 2002-12-03 05:33 AM Re: Script to check a mapped drive
MCA Offline
KiX Supporter
*****

Registered: 2000-04-28
Posts: 5152
Loc: Netherlands, EU
Dear,

To monitor possible problems with mappings we have create our script mappings.kix.
It can create historical and dynamic lists. With a quick look you can see that something
is going wrong. Mostly very useful when you have made recently changes to mapping part.

Another benefit is that the warning isn't a volatile message. For organizations who
are working 24 hours around the clock it can be really important to keep tracking of
possible problems. Keep tracking to prevent writting down every message. Keep
tracking for getting fast to the point. Keep tracking for management reports.

This script you can find on our site.
greetings.

btw: symbol  - on our homepage has been linked to related http://kixtart.org topic.
_________________________
email scripting@wanadoo.nl homepage scripting@wanadoo.nl | Links | Summary of Site Site KiXforms FAQ kixtart.org library collection mirror MCA | FAQ & UDF help file UDF kixtart.org library collection mirror MCA | mirror USA | mirror europe UDF scriptlogic library collection UDFs | mirror MCA

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 2220 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.07 seconds in which 0.04 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org