Page 1 of 1 1
Topic Options
#133785 - 2005-02-15 12:11 AM New server problem
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
I wound up cobbling together the following code to remove a persistent mapping when folks are logging in:
Code:

IF Exist('R:')
SHELL '%COMSPEC% /C NET USE R: /D > nul'
SLEEP 2
ENDIF
USE R: /delete /persistent
IF 0=Exist('R:')
USE R: '\\NEWSERVER\APPS'
ENDIF



Not only did I have to do this for our main login script, but had to do this for our Citrix boxes as well. It seems to me that this is over-kill, but it worked when I needed it this morning.

Thanks,

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

Top
#133786 - 2005-02-15 12:49 AM Re: New server problem
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Why not use any of the MapDrive UDFs that would take car of this automatically. And
Code:

if exist('R:\')
use R: /delete /persistent
if @error=0
use R: '\\NEWSERVER\APPS'
endif
endif


looks a little bit neater as well.
_________________________
There are two types of vessels, submarines and targets.

Top
#133787 - 2005-02-15 12:51 AM Re: New server problem
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
Why? You have this code...
Code:
Function MapDrive($Drive, $Server, $Share)

Dim $Drive, $Server, $Share, $shell
Color c+/n

If $Drive<>"" and $Server<>"" and $Share<>""
$LogText="Connecting $Drive to \\$Server\$Share"
? $LogText
USE $Drive /Delete /Persistent
USE $Drive "\\$Server\$Share"
If @error=0
color g+/n
$x=" - Success"
"$x"
If val($DOS) >= 5
$shell=createobject("shell.application")
$shell.namespace($Drive+"\").self.name=$Share + " on '" + $Server + "'"
$shell = 0
Endif
Else
color r+/n
$x=" - Failed: Error @error"
"$x"
$ErrorState=1
Endif
WriteLog ($LogText + $x)
WriteLog2("%temp%\MapDrive.log",$LogText + $x,1)
Color w+/n
Else
WriteLog ("Function 'MapDrive' called with invalid parameters: '$Drive', '$Server', '$Share'")
Endif
Endfunction


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

Top
#133788 - 2005-02-15 12:53 AM Re: New server problem
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11628
Loc: CA
Well my guess is that what Kent is trying to say is that for some reason KiXtart was unable to properly remove the drive mapping.

The portion that is missing in the UDF versions is what he posted already. Kent is not new here so I would assume he is already quite aware of all the Mapping UDFs.

SHELL '%COMSPEC% /C NET USE R: /D > nul'

Though, even NET USE has a persistent switch as well.

Top
#133789 - 2005-02-15 12:57 AM Re: New server problem
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
But why would NET USE succeed if USE fails? It's my impression that either one would call the same underlying API.

Edited by sealeopard (2005-02-15 04:06 AM)
_________________________
There are two types of vessels, submarines and targets.

Top
#133790 - 2005-02-15 12:58 AM Re: New server problem
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
Hence my question...Why? To date I have not had to resort to such things...
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#133791 - 2005-02-15 01:35 AM Re: New server problem
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Quote:

Though, even NET USE has a persistent switch as well.



...but not in combination with the /delete switch.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#133792 - 2005-02-15 04:01 AM Re: New server problem
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11628
Loc: CA
Hey didn't say I've had the problem.. I'm just guessing that something weird was causing an issue for Kent.

Will have to wait for Kent to come back and fill us in on the details of why KiX natively didn't work.

Top
#133793 - 2005-02-15 08:33 AM Re: New server problem
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
Guys.. I am working on using the Mapdrive UDF() as well as making all of our script UDF-based. This will make this easier to troubleshoot with known tried-and-true methods. Thanks Jens. It was a pretty hectic day today with this. What I need is a clean solution for removal of the old drives..

To lay this out a bit better:
Local workstation logins were using persistent
Citrix boxes were not using persistent

Both the local and Citrix were acting with the persistent in place.

Definitely odd.

Thanks,

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

Top
#133794 - 2005-02-15 02:53 PM Re: New server problem
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
I never understood why people map persistent in a logon script. I mean, it maps on every logon anyway???

In fact, I go out of my way to issue a NET USE /persistent:no to disable the default behavior. That way if users map their own drives they have to deliberately select "Reconnect at logon". This cuts down on the number of rogue drive mappings that sneak their way in to become legacy and then haunt you later.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#133795 - 2005-02-15 08:35 PM Re: New server problem
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
You are "preaching to the choir" here. Our login script was handed over to me. I am working on a new version that will use Jens MAPDRIVE() UDF and will be much better than the methods we have used.

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

Top
#133796 - 2005-02-15 09:49 PM Re: New server problem
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
I preach to the choir cuz they are a captive audience.
The sinners just get up and walk out.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#133797 - 2005-02-15 11:13 PM Re: New server problem
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
I am still here, but not as much as I used to be..

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

Top
#133798 - 2005-02-16 12:45 AM Re: New server problem
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Les:

Can you make a "preach to the choir" audition tape just like the one video in that "other" thread?
_________________________
There are two types of vessels, submarines and targets.

Top
#133799 - 2005-02-16 10:58 AM Re: New server problem
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
boys, you getting of-topic there...
_________________________
!

download KiXnet

Top
Page 1 of 1 1


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

Who's Online
1 registered (Allen) and 1198 anonymous users online.
Newest Members
M_Moore, BeeEm, min_seow, Audio, Hoschi
17883 Registered Users

Generated in 0.07 seconds in which 0.027 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