+ Post New Thread
Results 1 to 9 of 9
Windows Thread, Seeking a bit of guidance on vbs scripting. in Technical; We have been having a few printer issues of late so I decided to make my first venture forth into ...
  1. #1
    speckytecky's Avatar
    Join Date
    May 2006
    Location
    UK
    Posts
    2,497
    Thank Post
    3,372
    Thanked 256 Times in 209 Posts
    Blog Entries
    3
    Rep Power
    109

    Seeking a bit of guidance on vbs scripting.

    We have been having a few printer issues of late so I decided to make my first venture forth into vbs. Found the printers . vbs file. Made a copy of it and edited for one XP Pro room, Ran the vbs file locally and it did almost all I wanted logged on with admin rights - the exception being it failed to change the default printer.

    Then copy and pasted my edited room into the Netlogon Scripts printers . vbs file.

    Logging on as a student a couple of hours after this though it failed to apply at setting just one domain printer and leaving MS XPS Document Writer as the default.

    Why would this be happening?

  2. #2

    Steve21's Avatar
    Join Date
    Feb 2011
    Location
    Swindon
    Posts
    2,689
    Thank Post
    334
    Thanked 515 Times in 483 Posts
    Rep Power
    179
    Do the student accounts have access to run it? Bearing in mind login scripts run as user context.

    Steve

  3. #3
    speckytecky's Avatar
    Join Date
    May 2006
    Location
    UK
    Posts
    2,497
    Thank Post
    3,372
    Thanked 256 Times in 209 Posts
    Blog Entries
    3
    Rep Power
    109
    Thanks Steve,

    As the vbs sits in the scripts file in the Netlogon folder I was assuming that they must have. Perhaps not - how would I check they are enabled to run it on logon?

    Quote Originally Posted by Steve21 View Post
    Do the student accounts have access to run it? Bearing in mind login scripts run as user context.

    Steve

  4. #4
    ChrisH's Avatar
    Join Date
    Jun 2005
    Location
    East Lancs
    Posts
    4,999
    Thank Post
    120
    Thanked 280 Times in 258 Posts
    Rep Power
    106
    Add
    Wscript.echo "printer script run"

    To your script then you can get a pop up message if it has run.
    If it is running and the printer is still not working does the workstation have the driver for that printer installed?

  5. Thanks to ChrisH from:

    speckytecky (25th November 2011)

  6. #5

    Steve21's Avatar
    Join Date
    Feb 2011
    Location
    Swindon
    Posts
    2,689
    Thank Post
    334
    Thanked 515 Times in 483 Posts
    Rep Power
    179
    Quote Originally Posted by speckytecky View Post
    Thanks Steve,

    As the vbs sits in the scripts file in the Netlogon folder I was assuming that they must have. Perhaps not - how would I check they are enabled to run it on logon?
    As mentioned above, an echo will show if script runs. Also depends how you are setting default, if by exe is it blocked? If by regkey can users edit that part? Etc etc

    Might be worth sticking script up to take a look at,


    Steve

  7. Thanks to Steve21 from:

    speckytecky (25th November 2011)

  8. #6
    speckytecky's Avatar
    Join Date
    May 2006
    Location
    UK
    Posts
    2,497
    Thank Post
    3,372
    Thanked 256 Times in 209 Posts
    Blog Entries
    3
    Rep Power
    109
    Ok folks. I'm not going great guns with this vbs thing so thought I'd post up the content of our current printer script.

    the big thing that makes me head scratch is the fact there have been a lot of clients added since the script was last altered yet they seem to be picking up the default printer correctly from somewhere. Tomorrow that beastie gets put into retirement and a new machine takes it's place - gulp!

    Set WshNetwork = CreateObject("WScript.Network")
    Dim CN
    CN = WSHNetwork.ComputerName
    if CN = "HIPHOP3" or _
    CN = "HIPHOP4" or _
    CN = "HIPHOP6" or _
    CN = "STAFFROOM2" or _
    CN = "STAFFROOM3" or _
    CN = "STAFFROOM5" or _
    CN = "YOUR-E641889C92" or _
    CN = "MSILAPTOP-KP" then
    WshNetwork.AddwindowsPrinterConnection "\\LBROOM1\HPROOM5"
    WshNetwork.AddwindowsPrinterConnection "\\************-DC1\AP3800C-PCL5c"
    WshNetwork.SetDefaultPrinter "\\LBROOM1\HPROOM5"
    end if
    if CN = "FJSULNO1" or _
    CD = "M2No4" or _
    CD = "New55" or _
    CD = "MATHS72" or _
    CD = "M2No2" or _
    CD = "M2No1" or _
    CD = "New61" or _
    CD = "DUPLONE" then
    WshNetwork.AddwindowsPrinterConnection "\\************-DC1\AP3800C-PCL5c"
    WshNetwork.AddwindowsPrinterConnection "\\************-DC1\Ricoh Aficio 2060 PCL6"
    WshNetwork.SetDefaultPrinter "\\************-DC1\Ricoh Aficio 2060 PCL6"
    end if
    if CN = "LBROOM1" then
    WshNetwork.AddwindowsPrinterConnection "\\************-DC1\AP3800C-PCL5c"
    WshNetwork.SetDefaultPrinter "hp psc 700 series"
    end if
    if CN = "DOWNLOAD-CIZD2K" or _
    CD = "MATHS2" or _
    CD = "MATHS4" or _
    CD = "MATHS5" or _
    CD = "MATHS6" or _
    CD = "MATHS7" or _
    CD = "MATHS8" then
    WshNetwork.AddwindowsPrinterConnection "\\MATHS1\HPPSC700"
    WshNetwork.SetDefaultPrinter "\\MATHS1\HPPSC700"
    end if
    if CN = "TD7" or _
    CD = "td1" or _
    CD = "td2" or _
    CD = "kh12" or _
    CD = "td4" or _
    CD = "td8" or _
    CD = "td10" or _
    CD = "technology1" or _
    CD = "ict-room" then
    WshNetwork.AddwindowsPrinterConnection "\\TD7\JBN"
    WshNetwork.AddwindowsPrinterConnection "\\ict-room\RolandMO"
    WshNetwork.AddwindowsPrinterConnection "\\************-DC1\AP3800C-PCL5c"
    WshNetwork.AddwindowsPrinterConnection "\\************-DC1\Ricoh Aficio 2060 PCL6"
    WshNetwork.SetDefaultPrinter "\\************-DC1\AP3800C-PCL5c"
    end if
    if CN = "CYBERXP1" or _
    CD = "CYBERXP2" or _
    CD = "NEC100" then
    WshNetwork.AddwindowsPrinterConnection "\\XPSTATION1\BROTHERH"
    WshNetwork.AddwindowsPrinterConnection "\\XPSTATION1\HPPSC750"
    WshNetwork.SetDefaultPrinter "\\XPSTATION1\BROTHERH"
    end if
    if CN = "ITHS02" or _
    CD = "ITHS03" or _
    CD = "ITHS04" or _
    CD = "ITHS05" or _
    CD = "ITHS06" or _
    CD = "ITHS07" or _
    CD = "ITHS08" then
    WshNetwork.AddwindowsPrinterConnection "\\ITHS01\hppsc750"
    WshNetwork.AddwindowsPrinterConnection "\\ITHS01\RolandGX24"
    WshNetwork.SetDefaultPrinter "\\ITHS01\hppsc750"
    end if

  9. #7

    Steve21's Avatar
    Join Date
    Feb 2011
    Location
    Swindon
    Posts
    2,689
    Thank Post
    334
    Thanked 515 Times in 483 Posts
    Rep Power
    179
    Quote Originally Posted by speckytecky View Post
    the big thing that makes me head scratch is the fact there have been a lot of clients added since the script was last altered yet they seem to be picking up the default printer correctly from somewhere.
    Where's your "CD" declared? Is it just mass typo of CN?

    Steve

  10. Thanks to Steve21 from:

    speckytecky (30th November 2011)

  11. #8
    speckytecky's Avatar
    Join Date
    May 2006
    Location
    UK
    Posts
    2,497
    Thank Post
    3,372
    Thanked 256 Times in 209 Posts
    Blog Entries
    3
    Rep Power
    109
    Thanks Steve,

    Newbie I am for sure to VBS

    Can you explain what I'm missing in greater detail please.


    Quote Originally Posted by Steve21 View Post
    Where's your "CD" declared? Is it just mass typo of CN?

    Steve

  12. #9

    Steve21's Avatar
    Join Date
    Feb 2011
    Location
    Swindon
    Posts
    2,689
    Thank Post
    334
    Thanked 515 Times in 483 Posts
    Rep Power
    179
    Quote Originally Posted by speckytecky View Post
    Thanks Steve,

    Newbie I am for sure to VBS

    Can you explain what I'm missing in greater detail please.
    What I mean is like, from your original description are you saying some of the computers you've listed above "aren't" getting the right printer?

    If so it's because of your "CD" part, but just want to check before changing anything

    Steve

SHARE:
+ Post New Thread

Similar Threads

  1. New guidance on the use of CCTV in schools
    By use-IP in forum General Chat
    Replies: 15
    Last Post: 15th May 2012, 05:44 PM
  2. Return the switch placed on a VBS script
    By FatBoy in forum Coding
    Replies: 9
    Last Post: 20th May 2009, 02:49 PM
  3. Replies: 5
    Last Post: 14th June 2008, 12:18 AM
  4. [Video] Bit of a change on the commute into work
    By somabc in forum Jokes/Interweb Things
    Replies: 0
    Last Post: 2nd June 2008, 04:30 PM
  5. Replies: 13
    Last Post: 8th November 2007, 02:53 PM

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
  •