LotharGores
(Fresh Scripter)
2006-01-23 02:34 PM
Kix and deleting shares create by a netlogon share

How do I delete drive mappings created by netlogon scipt as kix does not seem to be able to delete those drive mappings (kix can delete its own created drive mappings) using “USE p: /DELETE”
(in this case p: was created previously using a batch file in the netlogon

Help is appreciated.


Radimus
(KiX Supporter)
2006-01-23 02:44 PM
Re: Kix and deleting shares create by a netlogon share

if there are files in use on the share, it will be hard to close the connection.

also, if the drive was mapped persistent it will come back at next logon, unless you add /persistent to the "use p: /delete /persistent"


LotharGores
(Fresh Scripter)
2006-01-23 04:38 PM
Re: Kix and deleting shares create by a netlogon share

Scenario,
I have been using a "logon.bat" in my netlogon up to now.
this created all my drives for me fine.

With KIX I am trying to reconnect those drives, but found that I had to first disconnect all drives created by my logon.bat before KIX will re-create those drives.

I have 1200 workstation and just cannot see how I am going to disconnect those drives.

Thanks


Radimus
(KiX Supporter)
2006-01-23 05:21 PM
Re: Kix and deleting shares create by a netlogon share

"use p: /delete /persistent"

or

"use * /delete /persistent" to delete them all


LotharGores
(Fresh Scripter)
2006-01-23 07:24 PM
Re: Kix and deleting shares create by a netlogon share

does not work - will only delte those drives created by KIX

LonkeroAdministrator
(KiX Master Guru)
2006-01-23 07:41 PM
Re: Kix and deleting shares create by a netlogon share

what is the error?

yes, the @error


Les
(KiX Master)
2006-01-23 08:07 PM
Re: Kix and deleting shares create by a netlogon share

Quote:

does not work - will only delte those drives created by KIX



I have to disagree. Perhaps does not work for you for unknown reasons.

The wildcard delete however is a bit version dependent due to a prior bug.


Howard Bullock
(KiX Supporter)
2006-01-23 08:46 PM
Re: Kix and deleting shares create by a netlogon share

I recommend delting the explicit drive just before you attempt to remap it. An example is shown below.

If this still fails then you will need to check @error @serror just after the stement: USE $Drive /Delete /Persistent

Be aware that my UDF call other UDF code that you may not have in your script.

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



LotharGores
(Fresh Scripter)
2006-01-23 09:23 PM
Re: Kix and deleting shares create by a netlogon share

Ok Here is what is happening:
WindowsXP SP2 workstation - Server 2003 SP1

I map my p: drive using DOS (net use p: \\server\share) - this maps my p drive for this test

now I run KIX:
A)
USE p: /DELETE /PERSIST
-- no error from @ERROR
looking at the windows xp explorer my P drive now changes to a "disconnected network drive" type

B)
next in the script:
USE p: "\\server\share" /persistent
-- error: "Connection to another network resource"

My old p mapping is still in a "disconnected network drive" state but when i cklick on the drive letter my old drive maps back.

If i use DOS and manually do above using:
net use p:/ d
net use p: \\server\share
everything works fine


NTDOCAdministrator
(KiX Master)
2006-01-23 09:53 PM
Re: Kix and deleting shares create by a netlogon share

Please run this and post the returned information.

Code:
Break On
@KIX ?
USE P: /DEL /PERSISTENT
'Return: ' +@ERROR +' '+@SERROR ?


 


Howard Bullock
(KiX Supporter)
2006-01-23 10:03 PM
Re: Kix and deleting shares create by a netlogon share

Is this "/PERSIST" a valid switch for USE? That was not in my example.

LotharGores
(Fresh Scripter)
2006-01-24 12:27 AM
Re: Kix and deleting shares create by a netlogon share

OK - what happened was is that one server (server1) hosting the share "sharename" broke.
\\server1\sharename

so I moved the share to a second server (server2) with the same sharename.
so now I have:
\\server2\sharename

and thats were kix stopped working.
I now re-created server1 and moved the share back to server1 (from server2) and EVERYTHING is working fine !?!?!?
Again, it seems that WindowsXP keeps a record of the share, and stopps kix from mapping the same share name to a different servernae - does this make any sense?


Rosario Carcò
(Fresh Scripter)
2006-02-28 04:06 PM
Re: Kix and deleting shares create by a netlogon share

Quote:

it seems that WindowsXP keeps a record of the share, and stopps kix from mapping the same share name to a different servernae - does this make any sense?




I am experiencing this very same behaviour since our Workstations started to run under XP. Under Win NT 4 and Win 2K my Kix-Login-Script, which is still the same, deleted the mapping before remapping it. Starting with XP, if the user maps something on a letter, say X:, the kix statement USE X: /DELETE can not free up the letter X: The user has to disconnect the drive first manually in the windows-explorer. Only after that, the letter can be used by kix at next logon. I did not try the suggested option /Delete /Persistent yet.

Ok, now I made another series of tests and the suggested Option does the trick. So use
Code:
USE X: /DELETE /PERSISTENT



to be sure that persistently mapped drives by the user are also disconnected and available for a new mapping.