+ Post New Thread
Page 2 of 2 FirstFirst 12
Results 16 to 24 of 24
Windows Thread, Logon script suddenly throwing up error in Technical; In your code you have repeated chunks of code regarding your DIMS ie Dim x As Integer or Dim strText ...
  1. #16

    mac_shinobi's Avatar
    Join Date
    Aug 2005
    Posts
    9,901
    Thank Post
    3,429
    Thanked 1,082 Times in 998 Posts
    Rep Power
    370
    In your code you have repeated chunks of code regarding your DIMS ie Dim x As Integer or Dim strText and the same for the creation of objects

    Code:
    -> Set objNetwork = CreateObject("WScript.Network") 
    Set WSHShell = CreateObject("WScript.Shell") 
    -> Set WshNetwork = WScript.CreateObject("WScript.Network")
    -> Set oNetwork = CreateObject("WScript.Network")
    Set clPrinters = WshNetwork.EnumPrinterConnections
    You only need one and whenever you need to use it again you just change the coding below to refer to one so you could delete the 2nd and 3rd one and only use the first one or however you wanted to do it as you dont need to create the same object with different variable names

    ie

    Code:
    Set WshNetwork = WScript.CreateObject("WScript.Network")
    
    Wscript.Echo WshNetwork.Username
    
    
    Are you able to post the few lines of code where you think its erroring out on ?

    Also you have a disconnect sub - which you shouldn't need as when you are mapping the printers there is a for loop that removes all printers before it re adds them.

    http://www.computerperformance.co.uk...e_8007007B.htm
    Last edited by mac_shinobi; 9th May 2011 at 04:34 PM.

  2. #17
    Cools's Avatar
    Join Date
    Jan 2009
    Location
    Bedfordshire
    Posts
    498
    Thank Post
    24
    Thanked 62 Times in 57 Posts
    Rep Power
    25
    at the end of day its for testing...
    not world order..

  3. #18

    mac_shinobi's Avatar
    Join Date
    Aug 2005
    Posts
    9,901
    Thank Post
    3,429
    Thanked 1,082 Times in 998 Posts
    Rep Power
    370
    Quote Originally Posted by Cools View Post
    at the end of day its for testing...
    not world order..
    what's that comment all about ?

    Just trying to tidy the code up so it makes more sense and not repeatdly re create the same objects with different variable names and the same for declaring of variables, its just not needed.

    Also could create a sub to take the server name and share name as the rest of the code regarding adding of a printer is the same

  4. #19

    Join Date
    Jan 2009
    Location
    Northants
    Posts
    143
    Thank Post
    5
    Thanked 11 Times in 10 Posts
    Rep Power
    13
    You could try updating/reinstallling WSH on the affected machines, i've had a few times where it can become messed up. There should be a download on the MS site ... Type Windows Script Host in the search

    Skr

  5. #20
    Andie's Avatar
    Join Date
    Sep 2006
    Location
    Cambridgeshire
    Posts
    797
    Thank Post
    167
    Thanked 66 Times in 49 Posts
    Rep Power
    30

    Progress of sorts

    OK, some progress. I spent about an hour looking at this with my secondary school technical support person. Turns out that the colour printer was a bit of a red herring - the current error points to line 138 or 148 depending on which of the scripts runs (logon or stafflogon). This line refers to the Y5Laser. The colour printer is being blocked because in one script it comes after the Y5Laser - in the other script it comes before.

    Quote Originally Posted by Cools View Post
    its just to check the connection to the printer..
    as student.. some thing has changed even if you dont know what it is..
    login in as admin is pointless as it's like having a master key to the school..

    the script is to just test the connection as a student on a student GPO.. its saying it cant find it... i could say theres a dns error but not knowing what its set up like..

    just try it for entertainment.. i have the same argument with virgin when things dont work.. and they say "Well everyone else is ok in the street" it does not help.
    Yes, thanks for the test script. The colour printer mapped and pings fine. The Y5Laser pings, but doesn't map, even as domain admin. We've checked the share name is correct and checked permissions, and checked the IP address of the port.

    I went and tested a random sample of other laptops that connect to Y5Laser. All are showing the same issue (although no one had logged it). We REMd out the Y5Laser lines in the script, and the scripting error went away. So there appears to be an issue with this particular printer and the curriculum laptops. Staff laptops, which aren't on the domain, print to it fine. Can do a test print direct from the server too. Ran out of time, but next test will be to run a test from a networked desktop in the IT Suite. I'm also going to double check the Y4Laser, as it is same make and model as Y5Laser. Both are HP 2200dn with JetDirect cards.
    Last edited by Andie; 12th May 2011 at 09:04 PM.

  6. #21
    Andie's Avatar
    Join Date
    Sep 2006
    Location
    Cambridgeshire
    Posts
    797
    Thank Post
    167
    Thanked 66 Times in 49 Posts
    Rep Power
    30
    Working on a YR4 laptop and it is fine, with no scripting error and the Y4Laser set as default. BUT just been to deal with a problem in year 3 on a laptop, and when they logged in they were getting a scripting error. This laptop had just been brought to me because it had failed to log on to the network, and had come up with a local profile (no scripting error then). When logged on next time, it had picked up the network, but had a scripting error.

  7. #22
    Andie's Avatar
    Join Date
    Sep 2006
    Location
    Cambridgeshire
    Posts
    797
    Thank Post
    167
    Thanked 66 Times in 49 Posts
    Rep Power
    30

    Latest Error Message

    Can anyone shed any light on this issue?

    The laptop I am using shows a printer connection to a printer called Y4Laser, with the printer set to Ready. I am logged in as domain admin. If I double click the printer, I get the attached on screen.

    I can't map to this printer from this laptop.

    The laptops behind me, using the same wireless connection to the network, can map to the printer with no error messages. All of the laptops in this room with me are in the same AD group and they were all imaged from the same build. The laptops behind me are a random sample from year 4. None have the scripting error. So far, this year group seems to be the only one unaffected by the issues with these laser printers, unless I have been incredibly lucky with my random sample.

    I can't work out what the link is.
    Attached Files Attached Files

  8. #23

    Join Date
    Jun 2007
    Location
    London
    Posts
    894
    Thank Post
    64
    Thanked 171 Times in 140 Posts
    Rep Power
    55
    Quote Originally Posted by Cools View Post
    at the end of day its for testing...
    not world order..
    Bad haiku? Poor quality pharmaceuticals?? Solar flare???

  9. #24
    Andie's Avatar
    Join Date
    Sep 2006
    Location
    Cambridgeshire
    Posts
    797
    Thank Post
    167
    Thanked 66 Times in 49 Posts
    Rep Power
    30
    After some more tests, have started a new thread:

    Weird: printer mapping issue
    Last edited by Andie; 19th May 2011 at 09:33 PM.

SHARE:
+ Post New Thread
Page 2 of 2 FirstFirst 12

Similar Threads

  1. Logon Script Not on 1 PC
    By karldenton in forum Windows
    Replies: 1
    Last Post: 25th March 2009, 12:05 PM
  2. Printers logon script error messages
    By indie in forum Windows
    Replies: 1
    Last Post: 14th September 2007, 11:34 AM
  3. Logon script & Printer script question.
    By Galway in forum Windows
    Replies: 3
    Last Post: 29th August 2007, 11:00 AM
  4. Yet another Logon Script
    By ajbritton in forum Windows
    Replies: 3
    Last Post: 19th June 2006, 09:47 AM
  5. Stupid CMD error with logon script
    By tarquel in forum Windows
    Replies: 37
    Last Post: 14th June 2006, 09:07 AM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •