?
Solved

Scripts working on all computers but one!?!?!

Posted on 2007-08-08
18
Medium Priority
?
285 Views
Last Modified: 2010-04-24
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.
0
Comment
Question by:Trafficpd
18 Comments
 
LVL 3

Expert Comment

by:DelTreme
ID: 19653309
What error message do you get? And does the script run at all (as in, half finished)?

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.
0
 

Author Comment

by:Trafficpd
ID: 19653495
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.
0
 
LVL 66

Expert Comment

by:Jim Horn
ID: 19654502
>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.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:Trafficpd
ID: 19654778
Jimhorn, I answered all those questions in the above comment.
0
 
LVL 65

Expert Comment

by:RobSampson
ID: 19659867
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.
0
 

Author Comment

by:Trafficpd
ID: 19662090
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.
0
 
LVL 65

Expert Comment

by:RobSampson
ID: 19666884
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.Network")
objNetwork.MapNetworkDrive strDriveLetter, strRemotePath

' Section which actually (re)names the Mapped Drive
Set objShell = CreateObject("Shell.Application")
objShell.NameSpace(strDriveLetter).Self.Name = strNewName
'========

Regards,

Rob.
0
 

Author Comment

by:Trafficpd
ID: 19668945
The code is like this

========================
set renameShell = createObject("shell.application")
mappedDrive = "F:\" 'Your drive letter
renameShell.nameSpace(mappedDrive).self.name = "Design"

set renameShell = createObject("shell.application")
mappedDrive = "G:\" 'Your drive letter
renameShell.nameSpace(mappedDrive).self.name = "CADD"
=======================

So yes its essentially exactly how you have it.
0
 
LVL 65

Expert Comment

by:RobSampson
ID: 19680513
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.application")
mappedDrive = "F:\" 'Your drive letter
If Right(mappedDrive, 1) = "\" Then mappedDrive = Left(mappedDrive, 2)
renameShell.nameSpace(mappedDrive).self.name = "Design"

set renameShell = createObject("shell.application")
mappedDrive = "G:\" 'Your drive letter
If Right(mappedDrive, 1) = "\" Then mappedDrive = Left(mappedDrive, 2)
renameShell.nameSpace(mappedDrive).self.name = "CADD"
=======================

Regards,

Rob.
0
 

Author Comment

by:Trafficpd
ID: 19718988
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.
0
 

Author Comment

by:Trafficpd
ID: 19775833
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?
0
 
LVL 65

Expert Comment

by:RobSampson
ID: 19779674
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.Network")
Set objFSO = CreateObject("Scripting.FileSystemObject")
strHostname = objNetwork.ComputerName
Set renameShell = CreateObject("Shell.Application")

If UCase(strHostname) = UCase("PROBLEMPC") Then
      mappedDrive = "F:\" 'Your drive letter
      If objFSO.DriveExists(mappedDrive) Then objNetwork.RemoveNetworkDrive mappedDrive, True, True
      WScript.Sleep 500
      objNetwork.MapNetworkDrive mappedDrive, "\\server\FShare", True
      WScript.Sleep 500
      renameShell.nameSpace(mappedDrive).self.name = "Design"
      WScript.Sleep 500
      
      mappedDrive = "G:\" 'Your drive letter
      If objFSO.DriveExists(mappedDrive) Then objNetwork.RemoveNetworkDrive mappedDrive, True, True
      WScript.Sleep 500
      objNetwork.MapNetworkDrive mappedDrive, "\\server\GShare", True      
      WScript.Sleep 500
      renameShell.nameSpace(mappedDrive).self.name = "CADD"
      WScript.Sleep 500
Else
      mappedDrive = "F:\" 'Your drive letter
      If Right(mappedDrive, 1) = "\" Then mappedDrive = Left(mappedDrive, 2)
      renameShell.nameSpace(mappedDrive).self.name = "Design"
      
      mappedDrive = "G:\" 'Your drive letter
      If Right(mappedDrive, 1) = "\" Then mappedDrive = Left(mappedDrive, 2)
      renameShell.nameSpace(mappedDrive).self.name = "CADD"
End If
'=======================

Regards,

Rob.
0
 

Author Comment

by:Trafficpd
ID: 19782090
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.Network")
Set objFSO = CreateObject("Scripting.FileSystemObject")
strHostname = objNetwork.ComputerName
Set renameShell = CreateObject("Shell.Application")

mappedDrive = "F:\" 'Your drive letter
If objFSO.DriveExists(mappedDrive) Then objNetwork.RemoveNetworkDrive mappedDrive, True, True
WScript.Sleep 500
objNetwork.MapNetworkDrive mappedDrive, "\\ARIES\Design", True
WScript.Sleep 500
renameShell.nameSpace(mappedDrive).self.name = "Design"
WScript.Sleep 500
     
mappedDrive = "G:\" 'Your drive letter
If objFSO.DriveExists(mappedDrive) Then objNetwork.RemoveNetworkDrive mappedDrive, True, True
WScript.Sleep 500
objNetwork.MapNetworkDrive mappedDrive, "\\Aries\cadd", True      
WScript.Sleep 500
renameShell.nameSpace(mappedDrive).self.name = "CADD"
WScript.Sleep 500

This is line 9 and Character 41 is the "o" in objNetwork:

If objFSO.DriveExists(mappedDrive) Then objNetwork.RemoveNetworkDrive mappedDrive, True, True
0
 
LVL 65

Expert Comment

by:RobSampson
ID: 19787643
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(mappedDrive) Then objNetwork.RemoveNetworkDrive Left(mappedDrive, 2), True, True

for both of the removals.....

Regards,

Rob.
0
 

Author Comment

by:Trafficpd
ID: 19790782
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.Network")
Set objFSO = CreateObject("Scripting.FileSystemObject")
strHostname = objNetwork.ComputerName
Set renameShell = CreateObject("Shell.Application")

mappedDrive = "F:\" 'Your drive letter
If objFSO.DriveExists(mappedDrive) Then objNetwork.RemoveNetworkDrive Left(mappedDrive, 2), True, True
WScript.Sleep 500
objNetwork.MapNetworkDrive mappedDrive, "\\ARIES\Design\", True
WScript.Sleep 500
renameShell.nameSpace(mappedDrive).self.name = "Design"
WScript.Sleep 500
     
mappedDrive = "G:\" 'Your drive letter
If objFSO.DriveExists(mappedDrive) Then objNetwork.RemoveNetworkDrive Left(mappedDrive, 2), True, True
WScript.Sleep 500
objNetwork.MapNetworkDrive mappedDrive, "\\Aries\cadd\", True      
WScript.Sleep 500
renameShell.nameSpace(mappedDrive).self.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
0
 
LVL 65

Accepted Solution

by:
RobSampson earned 2000 total points
ID: 19796465
OK, again, try removing the trailing slash, by using
objNetwork.MapNetworkDrive Left(mappedDrive, 2), "\\ARIES\Design\", True

for both MapNetworkDrive's.

Alternatively, I think you'll get away with just leaving it out of
mappedDrive = "F:\" 'Your drive letter
to become
mappedDrive = "F:" 'Your drive letter

Regards,

Rob.
0
 

Author Comment

by:Trafficpd
ID: 19799149
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.Network")
Set objFSO = CreateObject("Scripting.FileSystemObject")
strHostname = objNetwork.ComputerName
Set renameShell = CreateObject("Shell.Application")

     
mappedDrive = "G:" 'Your drive letter
If objFSO.DriveExists(mappedDrive) Then objNetwork.RemoveNetworkDrive Left(mappedDrive, 2), True, True
WScript.Sleep 500
objNetwork.MapNetworkDrive mappedDrive, "\\Aries\cadd", True      
WScript.Sleep 500
renameShell.nameSpace(mappedDrive).self.name = "Cadd"
WScript.Sleep 500

mappedDrive = "J:" 'Your drive letter
If objFSO.DriveExists(mappedDrive) Then objNetwork.RemoveNetworkDrive Left(mappedDrive, 2), True, True
WScript.Sleep 500
objNetwork.MapNetworkDrive mappedDrive, "\\ARIES\Engineering", True      
WScript.Sleep 500
renameShell.nameSpace(mappedDrive).self.name = "Engineering"
WScript.Sleep 500

mappedDrive = "I:" 'Your drive letter
If objFSO.DriveExists(mappedDrive) Then objNetwork.RemoveNetworkDrive Left(mappedDrive, 2), True, True
WScript.Sleep 500
objNetwork.MapNetworkDrive mappedDrive, "\\ARIES\Studies", True      
WScript.Sleep 500
renameShell.nameSpace(mappedDrive).self.name = "Studies"
WScript.Sleep 500

mappedDrive = "L:" 'Your drive letter
If objFSO.DriveExists(mappedDrive) Then objNetwork.RemoveNetworkDrive Left(mappedDrive, 2), True, True
WScript.Sleep 500
objNetwork.MapNetworkDrive mappedDrive, "\\ARIES\Reference Library - External Sources", True      
WScript.Sleep 500
renameShell.nameSpace(mappedDrive).self.name = "Reference Library - External"
WScript.Sleep 500

mappedDrive = "R:" 'Your drive letter
If objFSO.DriveExists(mappedDrive) Then objNetwork.RemoveNetworkDrive Left(mappedDrive, 2), True, True
WScript.Sleep 500
objNetwork.MapNetworkDrive mappedDrive, "\\ARIES\TPD Resources - Internally Developed", True      
WScript.Sleep 500
renameShell.nameSpace(mappedDrive).self.name = "TPD Resources - Internal"
WScript.Sleep 500

mappedDrive = "T:" 'Your drive letter
If objFSO.DriveExists(mappedDrive) Then objNetwork.RemoveNetworkDrive Left(mappedDrive, 2), True, True
WScript.Sleep 500
objNetwork.MapNetworkDrive mappedDrive, "\\Hermes\ftp", True      
WScript.Sleep 500
renameShell.nameSpace(mappedDrive).self.name = "FTP"
WScript.Sleep 500

mappedDrive = "U:" 'Your drive letter
If objFSO.DriveExists(mappedDrive) Then objNetwork.RemoveNetworkDrive Left(mappedDrive, 2), True, True
WScript.Sleep 500
objNetwork.MapNetworkDrive mappedDrive, "\\MERCURY\PersonalDrives", True      
WScript.Sleep 500
renameShell.nameSpace(mappedDrive).self.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
0
 
LVL 65

Expert Comment

by:RobSampson
ID: 19804857
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.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is an addendum to the following article: Acitve Directory based Outlook Signature (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_24950055.html) The script is fine, and works in normal client-server domains…
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Screencast - Getting to Know the Pipeline
Suggested Courses

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question