Page 1 of 1 1
Topic Options
#20417 - 2002-04-24 12:47 AM Command
2hotty Offline
Getting the hang of it

Registered: 2002-04-09
Posts: 76
Loc: London
Can anyone help me with the command to delete existing printer and network drive connections. So when they logon the drives and printers that have been maually connected to the machine will be deleted and only the drives and printers that are included in the script will exist. [Big Grin]
_________________________
Any problem encountered is a challenge to overcome.

Top
#20418 - 2002-04-23 02:11 PM Re: Command
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
2hotty,

From the manual..

Use USE "*" /DELETE

quote:

USE
Action
Lists the current connections. Can also be used to connect a device, such as a drive or a printer, to a network resource; or to disconnect a device from a network resource.

Syntax
USE LIST
USE <* | "device" | "resource"> /DELETE [/PERSISTENT]
USE ["device"] <"resource"> [/USER:user] [/PASSWORD:password] [/PERSISTENT]

Remarks
Use USE "*" /DELETE to delete all current connections except those to a NETLOGON share and those to the drive or share from which KiXtart was started.

If a resource name contains non-alphanumeric characters (such as - or +), enclose the name in quotation marks.

On Windows NT only, the /USER and /PASSWORD parameters enable overriding the security context of the current user.

Check the value of @ERROR to see if USE was successful (a value of 0 indicates success).

Examples
USE E: "\\SERVER\PUBLIC" /PERSISTENT
USE * /DELETE
USE E: "\\SERVER\PUBLIC" /user:Yogi /password:Bear
USE E: "\\SERVER\PUBLIC"
USE LPT1: "\\SERVER\LASER" /user:testlan\USER1
USE L: /DEL
USE LIST
USE H: @HOMESHR ; connect to user's home share
IF @ERROR = 0
H: ;
CD @HOMEDIR ; change directory to user's home directory
ENDIF

HTH,

- Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#20419 - 2002-04-23 03:31 PM Re: Command
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
You might want to provide us with more information. What are the client OS? DELPRINTERCONNECTION only works under Windows NT/2000/XP and can only delete networked printers but not local printers. For local printers you will have to delete the corresponding registry keys for that particular printer.

For the network shares see Kyders response.

[ 23 April 2002, 15:31: Message edited by: sealeopard ]
_________________________
There are two types of vessels, submarines and targets.

Top
#20420 - 2002-04-23 03:33 PM Re: Command
2hotty Offline
Getting the hang of it

Registered: 2002-04-09
Posts: 76
Loc: London
the client os are mainly NT & 2000. A few XP and a few 98. DO i place this command at the start of my script?
_________________________
Any problem encountered is a challenge to overcome.

Top
#20421 - 2002-05-20 04:58 PM Re: Command
MCA Offline
KiX Supporter
*****

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

You only need to place those commands "USE * /delete" and "DelPrinterConnection"
when you are changing the actual status.
To prevent unnecessary removement of mapped drives you can also
use following code:
code:
; (re)mapping drive U
;
IF (Exist("U:\.") = 1)
USE U: /delete /persistent
ENDIF
USE U: "\\server\share$$"
IF (@error <> 0)
? "Warning KIX: mappings problem with drive U. error @error (@serror)"
ENDIF

greetings.
_________________________
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 484 anonymous users online.
Newest Members
Sir_Barrington, batdk82, StuTheCoder, M_Moore, BeeEm
17886 Registered Users

Generated in 0.05 seconds in which 0.022 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