Windows scrip is not running on one specific pc

We are running win2003 server, and xp prof clients. Script logon.vbs doesn't work on one specific PC. Interesting is that same script works without problem for the same users on other clients. When user logs in on that not working pc scrip gives error:

---------------------------
Windows Script Host
---------------------------
Script:      \\backup\netlogon\logon.vbs
Line:      60
Char:      5
Error:      This network connection does not exist.

Code:      800708CA
Source:       WSHNetwork.RemoveNetworkDrive

---------------------------
OK  
---------------------------


I don't know is it network settings or something but everything looks the same to me. I don't think we have to look at script coz 50+ computers works with no problem just that on doesn't.


Any ideas?

Thanks
gdcobbAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

TyBeattyCommented:
What is that line of the script trying to do?  Looks as though it is trying to execute something possible from a mapped share or something that is not there at that time.  

I agree I don't think it is the script but something the script it doing is not working on that machine so lets see what is failing.  :)
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
gdcobbAuthor Commented:
Option Explicit

Dim objRootDSE, objTrans, strNetBIOSDomain, objNetwork, strNTName
Dim strUserDN, strComputerDN, objUser, strDNSDomain
Dim strComputer, objComputer, objGroup1, objGroup2
Dim strHomeDrive, strHomeShare
Dim WSHShell, WSHNetwork, objDomain, DomainString, UserString, UserObj, Path, strUNCPrinter

' Constants for the NameTranslate object.
Const ADS_NAME_INITTYPE_GC = 3
Const ADS_NAME_TYPE_NT4 = 3
Const ADS_NAME_TYPE_1779 = 1

Set objNetwork = CreateObject("Wscript.Network")

' Loop required for Win9x clients during logon.
strNTName = ""
On Error Resume Next
Do While strNTName = ""
  strNTName = objNetwork.userName
  Err.Clear
  If Wscript.Version > 5 Then
    Wscript.Sleep 100
  End If
Loop
On Error GoTo 0

' Determine DNS domain name from RootDSE object.
Set objRootDSE = GetObject("LDAP://cxmserver/RootDSE")
on error resume next
strDNSDomain = objRootDSE.Get("defaultNamingContext")

' Use the NameTranslate object to find the NetBIOS domain name from the
' DNS domain name.
Set objTrans = CreateObject("NameTranslate")
objTrans.Init ADS_NAME_INITTYPE_GC, ""
objTrans.Set ADS_NAME_TYPE_1779, strDNSDomain
strNetBIOSDomain = objTrans.Get(ADS_NAME_TYPE_NT4)
' Remove trailing backslash.
strNetBIOSDomain = Left(strNetBIOSDomain, Len(strNetBIOSDomain) - 1)

' Use the NameTranslate object to convert the NT user name to the
' Distinguished Name required for the LDAP provider.
objTrans.Set ADS_NAME_TYPE_NT4, strNetBIOSDomain & "\" & strNTName
strUserDN = objTrans.Get(ADS_NAME_TYPE_1779)

' Bind to the user object in Active Directory with the LDAP provider.
Set objUser = GetObject("LDAP://" & strUserDN)


' Bind to a group object in Active Directory with the LDAP provider.
Set objGroup1 = GetObject("LDAP://cn=Software,ou=groups,dc=cxm,dc=local")

' Map a network drive if the user is a member of the group.
If objGroup1.IsMember(objUser.AdsPath) Then
  On Error Resume Next
  objNetwork.MapNetworkDrive "S:", "\\cxmserver\data$\software"
  If Err.Number <> 0 Then
    On Error GoTo 0
    objNetwork.RemoveNetworkDrive "S:", True, True
    objNetwork.MapNetworkDrive "S:", "\\cxmserver\data$\software"
  End If
  On Error GoTo 0
End If

Set objGroup1 = GetObject("LDAP://cn=Kronos,ou=groups,dc=cxm,dc=local")

' Map a network drive if the user is a member of the group.
If objGroup1.IsMember(objUser.AdsPath) Then
  On Error Resume Next
  objNetwork.MapNetworkDrive "K:", "\\Cxmserver\Data$\Kronos"
  If Err.Number <> 0 Then
    On Error GoTo 0
    objNetwork.RemoveNetworkDrive "K:", True, True
    objNetwork.MapNetworkDrive "K:", "\\Cxmserver\Data$\kronos"
  End If
  On Error GoTo 0
End If

Set objGroup1 = GetObject("LDAP://cn=Everyone Drive,ou=groups,dc=cxm,dc=local")

' Map a network drive if the user is a member of the group.
If objGroup1.IsMember(objUser.AdsPath) Then
  On Error Resume Next
  objNetwork.MapNetworkDrive "I:", "\\Cxmserver\Data$\Everyone"
  If Err.Number <> 0 Then
    On Error GoTo 0
    objNetwork.RemoveNetworkDrive "I:", True, True
    objNetwork.MapNetworkDrive "I:", "\\Cxmserver\Data$\Everyone"
  End If
  On Error GoTo 0
End If

Set objGroup1 = GetObject("LDAP://cn=Minitab,ou=groups,dc=cxm,dc=local")

' Map a network drive if the user is a member of the group.
If objGroup1.IsMember(objUser.AdsPath) Then
  On Error Resume Next
  objNetwork.MapNetworkDrive "M:", "\\Cxmserver\Data$\minitab 14"
  If Err.Number <> 0 Then
    On Error GoTo 0
    objNetwork.RemoveNetworkDrive "M:", True, True
    objNetwork.MapNetworkDrive "M:", "\\Cxmserver\Data$\minitab 14"
  End If
  On Error GoTo 0
End If

Set objGroup1 = GetObject("LDAP://cn=Bar Code Group,ou=groups,dc=cxm,dc=local")

' Map a network drive if the user is a member of the group.
If objGroup1.IsMember(objUser.AdsPath) Then
  On Error Resume Next
  objNetwork.MapNetworkDrive "Q:", "\\cxmserver\data$\legi"
  If Err.Number <> 0 Then
    On Error GoTo 0
    objNetwork.RemoveNetworkDrive "Q:", True, True
    objNetwork.MapNetworkDrive "Q:", "\\cxmserver\data$\legi"
  End If
  On Error GoTo 0
End If

Set objGroup1 = GetObject("LDAP://cn=Payroll Group,ou=groups,dc=cxm,dc=local")

' Map a network drive if the user is a member of the group.
If objGroup1.IsMember(objUser.AdsPath) Then
  On Error Resume Next
  objNetwork.MapNetworkDrive "Z:", "\\cxmserver\data$\Payroll"
  If Err.Number <> 0 Then
    On Error GoTo 0
    objNetwork.RemoveNetworkDrive "Z:", True, True
    objNetwork.MapNetworkDrive "Z:", "\\cxmserver\data$\Payroll"
  End If
  On Error GoTo 0
End If

Set objGroup1 = GetObject("LDAP://cn=prism documentation group,ou=groups,dc=cxm,dc=local")

' Map a network drive if the user is a member of the group.
If objGroup1.IsMember(objUser.AdsPath) Then
  On Error Resume Next
  objNetwork.MapNetworkDrive "X:", "\\axis\volumes"
  If Err.Number <> 0 Then
    On Error GoTo 0
    objNetwork.RemoveNetworkDrive "X:", True, True
    objNetwork.MapNetworkDrive "X:", "\\axis\volumes"
  End If
  On Error GoTo 0
End If

Set objGroup1 = GetObject("LDAP://cn=jde documentation group,ou=groups,dc=cxm,dc=local")

' Map a network drive if the user is a member of the group.
If objGroup1.IsMember(objUser.AdsPath) Then
  On Error Resume Next
  objNetwork.MapNetworkDrive "X:", "\\axis\volumes"
  If Err.Number <> 0 Then
    On Error GoTo 0
    objNetwork.RemoveNetworkDrive "X:", True, True
    objNetwork.MapNetworkDrive "X:", "\\axis\volumes"
  End If
  On Error GoTo 0
End If

Set objGroup1 = GetObject("LDAP://cn=Microxcel CMM Group,ou=groups,dc=cxm,dc=local")

' Map a network drive if the user is a member of the group.
If objGroup1.IsMember(objUser.AdsPath) Then
  On Error Resume Next
  objNetwork.MapNetworkDrive "I:", "\\cxmserver\data$\everyone\engineer"
  If Err.Number <> 0 Then
    On Error GoTo 0
    objNetwork.RemoveNetworkDrive "I:", True, True
    objNetwork.MapNetworkDrive "I:", "\\cxmserver\data$\everyone\engineer"
  End If
  On Error GoTo 0
End If

Set objGroup1 = GetObject("LDAP://cn=Die Room EDM group,ou=groups,dc=cxm,dc=local")

' Map a network drive if the user is a member of the group.
If objGroup1.IsMember(objUser.AdsPath) Then
  On Error Resume Next
  objNetwork.MapNetworkDrive "I:", "\\cxmserver\data$\everyone\engineer\dieroom\edm"
  If Err.Number <> 0 Then
    On Error GoTo 0
    objNetwork.RemoveNetworkDrive "I:", True, True
    objNetwork.MapNetworkDrive "I:", "\\cxmserver\data$\everyone\engineer\dieroom\edm"
  End If
  On Error GoTo 0
End If

Set objGroup1 = GetObject("LDAP://cn=prints,ou=groups,dc=cxm,dc=local")

' Map a network drive if the user is a member of the group.
If objGroup1.IsMember(objUser.AdsPath) Then
  On Error Resume Next
  objNetwork.MapNetworkDrive "I:", "\\cxmserver\data$\Everyone\ENGINEER\Prints"
  If Err.Number <> 0 Then
    On Error GoTo 0
    objNetwork.RemoveNetworkDrive "I:", True, True
    objNetwork.MapNetworkDrive "I:", "\\cxmserver\data$\Everyone\ENGINEER\Prints"
  End If
  On Error GoTo 0
End If

Set objGroup1 = GetObject("LDAP://cn=Die Room Inventory Group,ou=groups,dc=cxm,dc=local")

' Map a network drive if the user is a member of the group.
If objGroup1.IsMember(objUser.AdsPath) Then
  On Error Resume Next
  objNetwork.MapNetworkDrive "I:", "\\cxmserver\data$\everyone\logs\EN - Engineering"
  If Err.Number <> 0 Then
    On Error GoTo 0
    objNetwork.RemoveNetworkDrive "I:", True, True
    objNetwork.MapNetworkDrive "I:", "\\cxmserver\data$\everyone\logs\EN - Engineering"
  End If
  On Error GoTo 0
End If

Set objGroup1 = GetObject("LDAP://cn=Judie,ou=groups,dc=cxm,dc=local")

' Map a network drive if the user is a member of the group.
If objGroup1.IsMember(objUser.AdsPath) Then
  On Error Resume Next
  objNetwork.MapNetworkDrive "J:", "\\cxmserver\data$\Home\jcuprisin"
  If Err.Number <> 0 Then
    On Error GoTo 0
    objNetwork.RemoveNetworkDrive "J:", True, True
    objNetwork.MapNetworkDrive "J:", "\\cxmserver\data$\Home\jcuprisin"
  End If
  On Error GoTo 0
End If

Set objGroup1 = GetObject("LDAP://cn=Mobile Users,ou=groups,dc=cxm,dc=local")

' Map a network drive if the user is a member of the group.
If objGroup1.IsMember(objUser.AdsPath) Then
  On Error Resume Next
  objNetwork.MapNetworkDrive "H:", "\\cxmserver\data$\Home\pbalson"
  If Err.Number <> 0 Then
    On Error GoTo 0
    objNetwork.RemoveNetworkDrive "H:", True, True
    objNetwork.MapNetworkDrive "H:", "\\cxmserver\data$\Home\pbalson"
  End If
  On Error GoTo 0
End If

Set objGroup1 = GetObject("LDAP://cn=DWG,ou=groups,dc=cxm,dc=local")

' Map a network drive if the user is a member of the group.
If objGroup1.IsMember(objUser.AdsPath) Then
  On Error Resume Next
  objNetwork.MapNetworkDrive "J:", "\\cxmserver\data$\Everyone\ENGINEER\DWG"
  If Err.Number <> 0 Then
    On Error GoTo 0
    objNetwork.RemoveNetworkDrive "J:", True, True
    objNetwork.MapNetworkDrive "J:", "\\cxmserver\data$\Everyone\ENGINEER\DWG"
  End If
  On Error GoTo 0
End If

Set objGroup1 = GetObject("LDAP://cn=all Clear,ou=Groups,dc=cxm,dc=local")

' Map a network drive if the user is a member of the group.
If objGroup1.IsMember(objUser.AdsPath) Then
  On Error Resume Next
  objNetwork.MapNetworkDrive "O:", "\\Cxmserver\Data$\AllClear"
  If Err.Number <> 0 Then
    On Error GoTo 0
    objNetwork.RemoveNetworkDrive "O:", True, True
    objNetwork.MapNetworkDrive "O:", "\\Cxmserver\Data$\AllClear"
  End If
  On Error GoTo 0
End If

Set objGroup1 = GetObject("LDAP://cn=jmillermobile,ou=groups,dc=cxm,dc=local")

' Map a network drive if the user is a member of the group.
If objGroup1.IsMember(objUser.AdsPath) Then
  On Error Resume Next
  objNetwork.MapNetworkDrive "H:", "\\cxmserver\data$\Home\jmiller"
  If Err.Number <> 0 Then
    On Error GoTo 0
    objNetwork.RemoveNetworkDrive "H:", True, True
    objNetwork.MapNetworkDrive "H:", "\\cxmserver\data$\Home\jmiller"
  End If
  On Error GoTo 0
End If

Set objGroup1 = GetObject("LDAP://cn=Maintenance schedule,ou=groups,dc=cxm,dc=local")

' Map a network drive if the user is a member of the group.
If objGroup1.IsMember(objUser.AdsPath) Then
  On Error Resume Next
  objNetwork.MapNetworkDrive "H:", "\\Cxmserver\Data$\Everyone\Maintenance\Schedules"
  If Err.Number <> 0 Then
    On Error GoTo 0
    objNetwork.RemoveNetworkDrive "H:", True, True
    objNetwork.MapNetworkDrive "H:", "\\Cxmserver\Data$\Everyone\Maintenance\Schedules"
  End If
  On Error GoTo 0
End If

Set WshNetwork = WScript.CreateObject("WScript.Network")
On Error Resume Next
Set WSHPrinters = WSHNetwork.EnumPrinterConnections
PrinterPath = "\\cxmserver\Finishing LJ 5si"
PrinterExists = False
For LOOP_COUNTER = 0 To WSHPrinters.Count - 1 Step 2
        If WSHPrinters.Item(LOOP_COUNTER +1) = PrinterPath Then
          PrinterExists = True
        End If
Next
If PrinterExists = 0 Then
  WshNetwork.AddWindowsPrinterConnection "\\cxmserver\Finishing LJ 5si"
End If

Set objNetwork = Wscript.CreateObject ("WScript.Network")

objNetwork.AddWindowsPrinterConnection "\\cxmserver\Maintenance Dell1700"
objNetwork.AddWindowsPrinterConnection "\\cxmserver\Purchasing"
objNetwork.AddWindowsPrinterConnection "\\cxmserver\Shipping dell 1700"
objNetwork.AddWindowsPrinterConnection "\\cxmserver\Die Room LJ 2100"
objNetwork.AddWindowsPrinterConnection "\\cxmserver\Lab LJ1700"
objNetwork.AddWindowsPrinterConnection "\\cxmserver\Finishing lj4000"
objNetwork.AddWindowsPrinterConnection "\\cxmserver\Copier Canon IR5000"
objNetwork.AddWindowsPrinterConnection "\\cxmserver\DellColor"
objNetwork.AddWindowsPrinterConnection "\\cxmserver\Customer service"
objNetwork.AddWindowsPrinterConnection "\\cxmserver\HPLaserJet 2100"
objNetwork.AddWindowsPrinterConnection "\\cxmserver\Accounting Color"
objNetwork.AddWindowsPrinterConnection "\\cxmserver\Accounting Color (Black)"
objNetwork.AddWindowsPrinterConnection "\\cxmserver\HR LJ3015"
objNetwork.AddWindowsPrinterConnection "\\cxmserver\Maintenance toshiba"
objNetwork.AddWindowsPrinterConnection "\\cxmserver\HP Designjet Z2100 44in Photo"
objNetwork.AddWindowsPrinterConnection "\\cxmserver\Shipfax"
objNetwork.AddWindowsPrinterConnection "\\cxmserver\Casting LJ2100"

Set objNetwork = Wscript.CreateObject ("WScript.Network")


' Clean up.
Set objRootDSE = Nothing
Set objTrans = Nothing
Set objNetwork = Nothing
Set objUser = Nothing
Set objComputer = Nothing
Set objGroup1 = Nothing
Set objGroup2 = Nothing
0
TyBeattyCommented:
Does the logon script complete the rest of it's jobs and is everthing ok at the end?

Basically it looks like that is the line that reads...
    objNetwork.RemoveNetworkDrive "S:", True, True

So if the S: drive does not exist it could throw that error because it cannot remove a drive mapping that is not there.
0
OWASP Proactive Controls

Learn the most important control and control categories that every architect and developer should include in their projects.

gdcobbAuthor Commented:
I deleted line 60
so now script gives me error on the line 60 again (original script would be line 61 you know what i mean)

---------------------------
Windows Script Host
---------------------------
Script:      C:\Documents and Settings\sjohnson\Desktop\logon.vbs
Line:      60
Char:      9
Error:      The system detected a possible attempt to compromise security. Please ensure that you can contact the server that authenticated you.

Code:      800704F1
Source:       WSHNetwork.MapNetworkDrive

---------------------------
OK  
---------------------------
0
Steve KnightIT ConsultancyCommented:
Most logically as it is trying to remove an "S:" drive mapping and then remap it is that this particular computer has an S: of it's own plugged in -- maybe a USB drive, DVD or CD drive has already been allocated the drive S: ?  What shows as S: on this computer when you login?  If so just change the drive letter of this drive in Disc Management to a lower letter not used by your script.

Steve
0
Steve KnightIT ConsultancyCommented:
Presumably this user is a member of the "software" group so continues to this section, and also may have an issues as suggested above.  Please check the real error which is occuring during the connection please as follows:

Running these commands instead:

 on error resume next
 wscript.echo "Trying S:"
 objNetwork.MapNetworkDrive "S:", "\\cxmserver\data$\software"
 if err.number <> 0 then wscript.echo "Error S:" & err.number & " " & err.description

for me for instance returns the following as I have a local "S:" drive:

Trying S:
Error S:-2147024811 The local device name is already in use.
 
0
gdcobbAuthor Commented:
This PC turns out has more problems windows just started to act  funny (some menu items missing, doesn't select options and etc) so I don't see reason to deal with it i'll go and rebuild it. Thanks for the thought i will spread the points
0
gdcobbAuthor Commented:
The problem is not related with script.
0
Steve KnightIT ConsultancyCommented:
Fair enough, trouble when we let users at the Pc's :-)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows Batch

From novice to tech pro — start learning today.