Page 2 of 2 <12
Topic Options
#71751 - 2002-11-21 04:38 PM Re: Want to make script wich delete's all network drives except Z:
bpsysadmin Offline
Fresh Scripter

Registered: 2002-10-18
Posts: 20
Howard..you are the greatest...much spanks!
Top
#71752 - 2002-11-21 05:55 PM Re: Want to make script wich delete's all network drives except Z:
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
Further testing reveals a code update is required. When deleting something that does not have a drive letter associated with it such as "\\server\IPC$" the use statement needs to be adjusted.
code:
for each $line in WshPipe("net use",1)
if left($line, 2) = "OK"
$drive = substr($line, 14, 2)
$path = substr($line, 24)
$path = left($path, instr($path, " ")-1)
if $drive <> "Z:"
if $drive = " "
;use $path /del
? "use $path /del "
else
;use $drive $path /del /persistent
? "use $drive $path /del /persistent"
endif
endif
endif
next

I originally thought that if the $drive variable contained spaces the free form langauage nature of KiXtart would just ignore it and process the command. Instead it generates an error.
quote:
2250 This network connection does not exist.
I added an extra conditional to account for this condition.
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#71753 - 2002-11-22 11:22 AM Re: Want to make script wich delete's all network drives except Z:
bpsysadmin Offline
Fresh Scripter

Registered: 2002-10-18
Posts: 20
Just like you I found that out [Smile] it's working now, really big thanks!
Top
Page 2 of 2 <12


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

Who's Online
0 registered and 194 anonymous users online.
Newest Members
BeeEm, min_seow, Audio, Hoschi, Comet
17882 Registered Users

Generated in 0.05 seconds in which 0.026 seconds were spent on a total of 13 queries. Zlib compression enabled.

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