Trafficpd
asked on
Scripts working on all computers but one!?!?!
Hey Guys,
I have about 125 computers in the company i work for all running windows xp with intel boards and processors. I have a bunch of different logon scripts that work on every computer except one. Any ideas as to why they wouldn't work on that one computer? Actually its not every script either its just a drive renameing script and a script setting the default networked printer.
I have about 125 computers in the company i work for all running windows xp with intel boards and processors. I have a bunch of different logon scripts that work on every computer except one. Any ideas as to why they wouldn't work on that one computer? Actually its not every script either its just a drive renameing script and a script setting the default networked printer.
ASKER
To answer your questions. Believe it or not we don't get any error message. There used to be one for the default printer one, i can't recall the message unfortunitly but that happened only a couple times and it hasn't happened since. The drives we are renameing are network drives so yes they are named the same. Yes, the printer is installed on the machine, luckily the guy it happens to is pretty computer savvy so he knows how to print to the printer anyway. The system has a dual core 3.2 ghz processor, 2gbs of ram, and a Nvidia Geforce 8800 GTS 640 MB video card. He has a gigabit network connection and its working fine. This "problem" really isn't so much of a problem as it is an inconvenience. Obviously the issue is easily worked around but we would like to eliminate it completely.
>Any ideas as to why they wouldn't work on that one computer?
Hmm, that's that 'mind reading' thing I was told I'm not very good at.
You'll need to spell out for us the specs you require for these scripts to run, anything you can about the pc in question, and what error message you receive.
Hmm, that's that 'mind reading' thing I was told I'm not very good at.
You'll need to spell out for us the specs you require for these scripts to run, anything you can about the pc in question, and what error message you receive.
ASKER
Jimhorn, I answered all those questions in the above comment.
So if there is no error, how do you know something is not working? For the drives, try manually disconnecting all drives on the client's profile, thereby removing any static references, and for the printers, try deleting all printers, and in the Printers and Faxes area, click File --> Server Properties, go the Drivers tab and remove the drivers. Then have the script install those drivers when it tries to connect the printers again.
Regards,
Rob.
Regards,
Rob.
ASKER
I know its not working because the names of the drives are not being renamed. Like i said theres over 125 computers here. The other computers drives are being renamed. I tired disconnecting the drives and that didn't help. As far as the printer script haveing it reinstall the drivers is not an option. But right now I am more concerned with the drive renameing because the printer on the workstation already has that printer as default and we don't really have to worry about it. Setting one station's printer manually isn't really going to kill us. Thanks for everyones input so far, I know I'm not giving you guys much to work with and I apologize for that. Obviously if i had more to tell you i would and if anything new comes up I'll be sure to let you know. Thanks again.
Is there any chance you could provide the piece of code that "renames" the network drives?
You can change sensitive names if required.
Is it something like the code posted here:
http://www.computerperformance.co.uk/ezine/ezine60.htm
which is
'========
strDriveLetter = "Y:"
strRemotePath = "\\alan\home"
strNewName = "GuyDives"
' Section to map the network drive
Set objNetwork = CreateObject("WScript.Netw ork")
objNetwork.MapNetworkDrive strDriveLetter, strRemotePath
' Section which actually (re)names the Mapped Drive
Set objShell = CreateObject("Shell.Applic ation")
objShell.NameSpace(strDriv eLetter).S elf.Name = strNewName
'========
Regards,
Rob.
You can change sensitive names if required.
Is it something like the code posted here:
http://www.computerperformance.co.uk/ezine/ezine60.htm
which is
'========
strDriveLetter = "Y:"
strRemotePath = "\\alan\home"
strNewName = "GuyDives"
' Section to map the network drive
Set objNetwork = CreateObject("WScript.Netw
objNetwork.MapNetworkDrive
' Section which actually (re)names the Mapped Drive
Set objShell = CreateObject("Shell.Applic
objShell.NameSpace(strDriv
'========
Regards,
Rob.
ASKER
The code is like this
========================
set renameShell = createObject("shell.applic ation")
mappedDrive = "F:\" 'Your drive letter
renameShell.nameSpace(mapp edDrive).s elf.name = "Design"
set renameShell = createObject("shell.applic ation")
mappedDrive = "G:\" 'Your drive letter
renameShell.nameSpace(mapp edDrive).s elf.name = "CADD"
=======================
So yes its essentially exactly how you have it.
========================
set renameShell = createObject("shell.applic
mappedDrive = "F:\" 'Your drive letter
renameShell.nameSpace(mapp
set renameShell = createObject("shell.applic
mappedDrive = "G:\" 'Your drive letter
renameShell.nameSpace(mapp
=======================
So yes its essentially exactly how you have it.
The only difference between your code and that code in the link it the trailing slash on the end of the drive letter. I have no idea if that would make a difference, but try this:
========================
set renameShell = createObject("shell.applic ation")
mappedDrive = "F:\" 'Your drive letter
If Right(mappedDrive, 1) = "\" Then mappedDrive = Left(mappedDrive, 2)
renameShell.nameSpace(mapp edDrive).s elf.name = "Design"
set renameShell = createObject("shell.applic ation")
mappedDrive = "G:\" 'Your drive letter
If Right(mappedDrive, 1) = "\" Then mappedDrive = Left(mappedDrive, 2)
renameShell.nameSpace(mapp edDrive).s elf.name = "CADD"
=======================
Regards,
Rob.
========================
set renameShell = createObject("shell.applic
mappedDrive = "F:\" 'Your drive letter
If Right(mappedDrive, 1) = "\" Then mappedDrive = Left(mappedDrive, 2)
renameShell.nameSpace(mapp
set renameShell = createObject("shell.applic
mappedDrive = "G:\" 'Your drive letter
If Right(mappedDrive, 1) = "\" Then mappedDrive = Left(mappedDrive, 2)
renameShell.nameSpace(mapp
=======================
Regards,
Rob.
ASKER
Hey Rob, I am very sorry i have almost left this alone this week. it was a pretty busy week. I will test this code out on monday and tell you what the results were. Thanks for all your help.
ASKER
Hey Rob I just tested out the code you suggested and unfortunitly the results were the same. This problem is so baffeling to me. If a code works on one computer shouldn't it work on all of them being that they are all the same specs? Its so weird that this one computer is doing this. On a side note we it has come to our attention that there are about 3 or 4 others computers that it dosn't work on. Unfortunitly there is no ovbious trait in any of these computers that are similar to each other but differnet to everyone else's. I wonder if reloading the OS would help? I would like to try this but it's just not feasible at this point to test out. Has anyone ever heard of reloading the OS to fix issues like this?
Is one of the drives getting renames. but not the second? Do you have On Error Resume Next, and if so, try commenting it out.
Also, you may want the script to try removing the drive then mapping it, then renaming it....you could it for that PC only......just change PROBLEMPC to the hostname, and the relevant share paths....
'========================
Set objNetwork = CreateObject("WScript.Netw ork")
Set objFSO = CreateObject("Scripting.Fi leSystemOb ject")
strHostname = objNetwork.ComputerName
Set renameShell = CreateObject("Shell.Applic ation")
If UCase(strHostname) = UCase("PROBLEMPC") Then
mappedDrive = "F:\" 'Your drive letter
If objFSO.DriveExists(mappedD rive) Then objNetwork.RemoveNetworkDr ive mappedDrive, True, True
WScript.Sleep 500
objNetwork.MapNetworkDrive mappedDrive, "\\server\FShare", True
WScript.Sleep 500
renameShell.nameSpace(mapp edDrive).s elf.name = "Design"
WScript.Sleep 500
mappedDrive = "G:\" 'Your drive letter
If objFSO.DriveExists(mappedD rive) Then objNetwork.RemoveNetworkDr ive mappedDrive, True, True
WScript.Sleep 500
objNetwork.MapNetworkDrive mappedDrive, "\\server\GShare", True
WScript.Sleep 500
renameShell.nameSpace(mapp edDrive).s elf.name = "CADD"
WScript.Sleep 500
Else
mappedDrive = "F:\" 'Your drive letter
If Right(mappedDrive, 1) = "\" Then mappedDrive = Left(mappedDrive, 2)
renameShell.nameSpace(mapp edDrive).s elf.name = "Design"
mappedDrive = "G:\" 'Your drive letter
If Right(mappedDrive, 1) = "\" Then mappedDrive = Left(mappedDrive, 2)
renameShell.nameSpace(mapp edDrive).s elf.name = "CADD"
End If
'=======================
Regards,
Rob.
Also, you may want the script to try removing the drive then mapping it, then renaming it....you could it for that PC only......just change PROBLEMPC to the hostname, and the relevant share paths....
'========================
Set objNetwork = CreateObject("WScript.Netw
Set objFSO = CreateObject("Scripting.Fi
strHostname = objNetwork.ComputerName
Set renameShell = CreateObject("Shell.Applic
If UCase(strHostname) = UCase("PROBLEMPC") Then
mappedDrive = "F:\" 'Your drive letter
If objFSO.DriveExists(mappedD
WScript.Sleep 500
objNetwork.MapNetworkDrive
WScript.Sleep 500
renameShell.nameSpace(mapp
WScript.Sleep 500
mappedDrive = "G:\" 'Your drive letter
If objFSO.DriveExists(mappedD
WScript.Sleep 500
objNetwork.MapNetworkDrive
WScript.Sleep 500
renameShell.nameSpace(mapp
WScript.Sleep 500
Else
mappedDrive = "F:\" 'Your drive letter
If Right(mappedDrive, 1) = "\" Then mappedDrive = Left(mappedDrive, 2)
renameShell.nameSpace(mapp
mappedDrive = "G:\" 'Your drive letter
If Right(mappedDrive, 1) = "\" Then mappedDrive = Left(mappedDrive, 2)
renameShell.nameSpace(mapp
End If
'=======================
Regards,
Rob.
ASKER
No there is no on error resume next. None of the drives are being renamed.
I am testing your new code and getting an error. I created a seperate test script for our testing purposes to use on the culprit pc so the if problem pc statement won't be nessecary. I am getting an error with the code stating line 9 character 41 "This network connection does not exist". Heres my code.
Set objNetwork = CreateObject("WScript.Netw ork")
Set objFSO = CreateObject("Scripting.Fi leSystemOb ject")
strHostname = objNetwork.ComputerName
Set renameShell = CreateObject("Shell.Applic ation")
mappedDrive = "F:\" 'Your drive letter
If objFSO.DriveExists(mappedD rive) Then objNetwork.RemoveNetworkDr ive mappedDrive, True, True
WScript.Sleep 500
objNetwork.MapNetworkDrive mappedDrive, "\\ARIES\Design", True
WScript.Sleep 500
renameShell.nameSpace(mapp edDrive).s elf.name = "Design"
WScript.Sleep 500
mappedDrive = "G:\" 'Your drive letter
If objFSO.DriveExists(mappedD rive) Then objNetwork.RemoveNetworkDr ive mappedDrive, True, True
WScript.Sleep 500
objNetwork.MapNetworkDrive mappedDrive, "\\Aries\cadd", True
WScript.Sleep 500
renameShell.nameSpace(mapp edDrive).s elf.name = "CADD"
WScript.Sleep 500
This is line 9 and Character 41 is the "o" in objNetwork:
If objFSO.DriveExists(mappedD rive) Then objNetwork.RemoveNetworkDr ive mappedDrive, True, True
I am testing your new code and getting an error. I created a seperate test script for our testing purposes to use on the culprit pc so the if problem pc statement won't be nessecary. I am getting an error with the code stating line 9 character 41 "This network connection does not exist". Heres my code.
Set objNetwork = CreateObject("WScript.Netw
Set objFSO = CreateObject("Scripting.Fi
strHostname = objNetwork.ComputerName
Set renameShell = CreateObject("Shell.Applic
mappedDrive = "F:\" 'Your drive letter
If objFSO.DriveExists(mappedD
WScript.Sleep 500
objNetwork.MapNetworkDrive
WScript.Sleep 500
renameShell.nameSpace(mapp
WScript.Sleep 500
mappedDrive = "G:\" 'Your drive letter
If objFSO.DriveExists(mappedD
WScript.Sleep 500
objNetwork.MapNetworkDrive
WScript.Sleep 500
renameShell.nameSpace(mapp
WScript.Sleep 500
This is line 9 and Character 41 is the "o" in objNetwork:
If objFSO.DriveExists(mappedD
OK, that's odd! For that line, it tries to remove the drive letter only if it exists.....maybe it needs the trailing slash removed, try this instead:
If objFSO.DriveExists(mappedD rive) Then objNetwork.RemoveNetworkDr ive Left(mappedDrive, 2), True, True
for both of the removals.....
Regards,
Rob.
If objFSO.DriveExists(mappedD
for both of the removals.....
Regards,
Rob.
ASKER
Well the good news is that definitly took care of that error. The bad news is there is another error on line 11 character 1 "The specified device name is invalid."
'RENAMING OF NETWORK SHARES
Set objNetwork = CreateObject("WScript.Netw ork")
Set objFSO = CreateObject("Scripting.Fi leSystemOb ject")
strHostname = objNetwork.ComputerName
Set renameShell = CreateObject("Shell.Applic ation")
mappedDrive = "F:\" 'Your drive letter
If objFSO.DriveExists(mappedD rive) Then objNetwork.RemoveNetworkDr ive Left(mappedDrive, 2), True, True
WScript.Sleep 500
objNetwork.MapNetworkDrive mappedDrive, "\\ARIES\Design\", True
WScript.Sleep 500
renameShell.nameSpace(mapp edDrive).s elf.name = "Design"
WScript.Sleep 500
mappedDrive = "G:\" 'Your drive letter
If objFSO.DriveExists(mappedD rive) Then objNetwork.RemoveNetworkDr ive Left(mappedDrive, 2), True, True
WScript.Sleep 500
objNetwork.MapNetworkDrive mappedDrive, "\\Aries\cadd\", True
WScript.Sleep 500
renameShell.nameSpace(mapp edDrive).s elf.name = "CADD"
WScript.Sleep 500
This is the line the error is on:
objNetwork.MapNetworkDrive mappedDrive, "\\ARIES\Design\", True
Thanks again for all your help. I have a feeling we are getting close to a solution.
~Jason
'RENAMING OF NETWORK SHARES
Set objNetwork = CreateObject("WScript.Netw
Set objFSO = CreateObject("Scripting.Fi
strHostname = objNetwork.ComputerName
Set renameShell = CreateObject("Shell.Applic
mappedDrive = "F:\" 'Your drive letter
If objFSO.DriveExists(mappedD
WScript.Sleep 500
objNetwork.MapNetworkDrive
WScript.Sleep 500
renameShell.nameSpace(mapp
WScript.Sleep 500
mappedDrive = "G:\" 'Your drive letter
If objFSO.DriveExists(mappedD
WScript.Sleep 500
objNetwork.MapNetworkDrive
WScript.Sleep 500
renameShell.nameSpace(mapp
WScript.Sleep 500
This is the line the error is on:
objNetwork.MapNetworkDrive
Thanks again for all your help. I have a feeling we are getting close to a solution.
~Jason
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Great news Rob! The Code Is working! Here is my final code. (Notice the one of the drives we were testing on before is not included. We are in the process of a huge folder restructure in the company and yesterday that drive was removed.)
'RENAMING OF NETWORK SHARES
Set objNetwork = CreateObject("WScript.Netw ork")
Set objFSO = CreateObject("Scripting.Fi leSystemOb ject")
strHostname = objNetwork.ComputerName
Set renameShell = CreateObject("Shell.Applic ation")
mappedDrive = "G:" 'Your drive letter
If objFSO.DriveExists(mappedD rive) Then objNetwork.RemoveNetworkDr ive Left(mappedDrive, 2), True, True
WScript.Sleep 500
objNetwork.MapNetworkDrive mappedDrive, "\\Aries\cadd", True
WScript.Sleep 500
renameShell.nameSpace(mapp edDrive).s elf.name = "Cadd"
WScript.Sleep 500
mappedDrive = "J:" 'Your drive letter
If objFSO.DriveExists(mappedD rive) Then objNetwork.RemoveNetworkDr ive Left(mappedDrive, 2), True, True
WScript.Sleep 500
objNetwork.MapNetworkDrive mappedDrive, "\\ARIES\Engineering", True
WScript.Sleep 500
renameShell.nameSpace(mapp edDrive).s elf.name = "Engineering"
WScript.Sleep 500
mappedDrive = "I:" 'Your drive letter
If objFSO.DriveExists(mappedD rive) Then objNetwork.RemoveNetworkDr ive Left(mappedDrive, 2), True, True
WScript.Sleep 500
objNetwork.MapNetworkDrive mappedDrive, "\\ARIES\Studies", True
WScript.Sleep 500
renameShell.nameSpace(mapp edDrive).s elf.name = "Studies"
WScript.Sleep 500
mappedDrive = "L:" 'Your drive letter
If objFSO.DriveExists(mappedD rive) Then objNetwork.RemoveNetworkDr ive Left(mappedDrive, 2), True, True
WScript.Sleep 500
objNetwork.MapNetworkDrive mappedDrive, "\\ARIES\Reference Library - External Sources", True
WScript.Sleep 500
renameShell.nameSpace(mapp edDrive).s elf.name = "Reference Library - External"
WScript.Sleep 500
mappedDrive = "R:" 'Your drive letter
If objFSO.DriveExists(mappedD rive) Then objNetwork.RemoveNetworkDr ive Left(mappedDrive, 2), True, True
WScript.Sleep 500
objNetwork.MapNetworkDrive mappedDrive, "\\ARIES\TPD Resources - Internally Developed", True
WScript.Sleep 500
renameShell.nameSpace(mapp edDrive).s elf.name = "TPD Resources - Internal"
WScript.Sleep 500
mappedDrive = "T:" 'Your drive letter
If objFSO.DriveExists(mappedD rive) Then objNetwork.RemoveNetworkDr ive Left(mappedDrive, 2), True, True
WScript.Sleep 500
objNetwork.MapNetworkDrive mappedDrive, "\\Hermes\ftp", True
WScript.Sleep 500
renameShell.nameSpace(mapp edDrive).s elf.name = "FTP"
WScript.Sleep 500
mappedDrive = "U:" 'Your drive letter
If objFSO.DriveExists(mappedD rive) Then objNetwork.RemoveNetworkDr ive Left(mappedDrive, 2), True, True
WScript.Sleep 500
objNetwork.MapNetworkDrive mappedDrive, "\\MERCURY\PersonalDrives" , True
WScript.Sleep 500
renameShell.nameSpace(mapp edDrive).s elf.name = "User Drive (Secure)"
WScript.Sleep 500
A couple side notes Rob. If you notice i took your advice of getting rid of the "\" after the drive letter but the code still need the "(mappedDrive, 2)" in order to work. Also for some reason after making that last change you told me to do it didn't work right away so i was playing with it trying different things and nothing seemed to be working. then finally i went back to the origianl code and was about to send another message saying still no luck when i decided to try the original code and it worked. Not sure why, I'm almost positive I didn't do anything different. Again thank you very much for all your help. It's been a pleasure working with you Rob
Thanks,
Jason
'RENAMING OF NETWORK SHARES
Set objNetwork = CreateObject("WScript.Netw
Set objFSO = CreateObject("Scripting.Fi
strHostname = objNetwork.ComputerName
Set renameShell = CreateObject("Shell.Applic
mappedDrive = "G:" 'Your drive letter
If objFSO.DriveExists(mappedD
WScript.Sleep 500
objNetwork.MapNetworkDrive
WScript.Sleep 500
renameShell.nameSpace(mapp
WScript.Sleep 500
mappedDrive = "J:" 'Your drive letter
If objFSO.DriveExists(mappedD
WScript.Sleep 500
objNetwork.MapNetworkDrive
WScript.Sleep 500
renameShell.nameSpace(mapp
WScript.Sleep 500
mappedDrive = "I:" 'Your drive letter
If objFSO.DriveExists(mappedD
WScript.Sleep 500
objNetwork.MapNetworkDrive
WScript.Sleep 500
renameShell.nameSpace(mapp
WScript.Sleep 500
mappedDrive = "L:" 'Your drive letter
If objFSO.DriveExists(mappedD
WScript.Sleep 500
objNetwork.MapNetworkDrive
WScript.Sleep 500
renameShell.nameSpace(mapp
WScript.Sleep 500
mappedDrive = "R:" 'Your drive letter
If objFSO.DriveExists(mappedD
WScript.Sleep 500
objNetwork.MapNetworkDrive
WScript.Sleep 500
renameShell.nameSpace(mapp
WScript.Sleep 500
mappedDrive = "T:" 'Your drive letter
If objFSO.DriveExists(mappedD
WScript.Sleep 500
objNetwork.MapNetworkDrive
WScript.Sleep 500
renameShell.nameSpace(mapp
WScript.Sleep 500
mappedDrive = "U:" 'Your drive letter
If objFSO.DriveExists(mappedD
WScript.Sleep 500
objNetwork.MapNetworkDrive
WScript.Sleep 500
renameShell.nameSpace(mapp
WScript.Sleep 500
A couple side notes Rob. If you notice i took your advice of getting rid of the "\" after the drive letter but the code still need the "(mappedDrive, 2)" in order to work. Also for some reason after making that last change you told me to do it didn't work right away so i was playing with it trying different things and nothing seemed to be working. then finally i went back to the origianl code and was about to send another message saying still no luck when i decided to try the original code and it worked. Not sure why, I'm almost positive I didn't do anything different. Again thank you very much for all your help. It's been a pleasure working with you Rob
Thanks,
Jason
Wow, don't you love inconsistent results?!?! Still, very happy that it worked!
It seems awfully strange that even though the mappedDrive value is only 2 characters in lenght, that you still needed Left(mappedDrive, 2)
But still, at least it works. Over time, particularly with working on scripts on EE, in a lot of situations the WScript.Sleep value has been required, and sometime even increased to one or two seconds, just to let the system "catch up".
Odd behaviour....anyway, thanks for posting your results.
Regards,
Rob.
It seems awfully strange that even though the mappedDrive value is only 2 characters in lenght, that you still needed Left(mappedDrive, 2)
But still, at least it works. Over time, particularly with working on scripts on EE, in a lot of situations the WScript.Sleep value has been required, and sometime even increased to one or two seconds, just to let the system "catch up".
Odd behaviour....anyway, thanks for posting your results.
Regards,
Rob.
Is the drive you are renaming, named the same at every PC before the renaming occurs? Is the network printer you are trying to set to default installed on that PC?
It's quite hard to answer this question without knowing anything about the PC, but my bet is it's either the PC's hardware, the settings in Windows or the network connection.