+ Post New Thread
Results 1 to 15 of 15
Windows Thread, VBS Logon Scrip in Technical; Afternoon All Anyone use VBScript for their logon script? I have an RM CC3 network and I want to set ...
  1. #1

    Join Date
    Jun 2008
    Location
    Dorset
    Posts
    74
    Thank Post
    7
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    VBS Logon Scrip

    Afternoon All

    Anyone use VBScript for their logon script? I have an RM CC3 network and I want to set some PCs up to use AD instead of logging on via RM. I need to map their drives so, having used VBS in the past, set to creating a login script. However, whenever I run the script I get the attached error. My server name is correct as is the sharename.

    I'm using the following code:

    Option Explicit
    Dim WshNetwork

    Set WshNetwork = WScript.CreateObject("WScript.Network")
    WshNetwork.MapNetworkDrive "S:", "\\admin\sims\"

    WScript.Quit



    Cant work this out - any ideas?

    Cheers
    Attached Files Attached Files
    Last edited by brahma; 8th August 2008 at 01:42 PM.

  2. #2

    FN-GM's Avatar
    Join Date
    Jun 2007
    Location
    UK
    Posts
    15,389
    Thank Post
    797
    Thanked 1,587 Times in 1,390 Posts
    Blog Entries
    10
    Rep Power
    427
    To make things easier i would use a batch script

    Code:
    net use: g: "\\sevrer\share"
    Please can we have a copy of your vbs script code, there is an error in it.

  3. #3

    FN-GM's Avatar
    Join Date
    Jun 2007
    Location
    UK
    Posts
    15,389
    Thank Post
    797
    Thanked 1,587 Times in 1,390 Posts
    Blog Entries
    10
    Rep Power
    427
    there you go, this will work

    Code:
    On Error Resume Next
    Dim WshNetwork
    
    Set WshNetwork = WScript.CreateObject("WScript.Network")
    WshNetwork.MapNetworkDrive "s:", "\\admin\sims"
    
    WScript.Quit
    Last edited by FN-GM; 8th August 2008 at 01:56 PM.

  4. Thanks to FN-GM from:

    brahma (8th August 2008)

  5. #4
    ChrisH's Avatar
    Join Date
    Jun 2005
    Location
    East Lancs
    Posts
    4,938
    Thank Post
    114
    Thanked 272 Times in 250 Posts
    Rep Power
    104
    Looks like the path to share is wrong and not a problem with the script syntax.

  6. #5

    FN-GM's Avatar
    Join Date
    Jun 2007
    Location
    UK
    Posts
    15,389
    Thank Post
    797
    Thanked 1,587 Times in 1,390 Posts
    Blog Entries
    10
    Rep Power
    427
    it was the \ at the end of the path.

  7. #6
    ChrisH's Avatar
    Join Date
    Jun 2005
    Location
    East Lancs
    Posts
    4,938
    Thank Post
    114
    Thanked 272 Times in 250 Posts
    Rep Power
    104
    Hmm strange. I never use hard coded paths usually though and build mine up from constants set at the top even for a few lines like that. Just habit I suppose as scripts have a tendancy to expand.

  8. #7

    Join Date
    Jun 2008
    Location
    Dorset
    Posts
    74
    Thank Post
    7
    Thanked 0 Times in 0 Posts
    Rep Power
    0
    FN-Greatermanchester - you are a star!! I've been looking at this for hours - guess I got to the stage where I couldn't see the wood for the trees!! Thanks again.

    Incidentally - do you know of a good reference (book or web site) for vbscipt coding that can be used in login scripts?

    Many thanks

  9. #8
    petectid's Avatar
    Join Date
    Jun 2005
    Posts
    298
    Thank Post
    2
    Thanked 15 Times in 13 Posts
    Rep Power
    19
    There is a good site for scripting here

  10. #9

    FN-GM's Avatar
    Join Date
    Jun 2007
    Location
    UK
    Posts
    15,389
    Thank Post
    797
    Thanked 1,587 Times in 1,390 Posts
    Blog Entries
    10
    Rep Power
    427
    Quote Originally Posted by brahma View Post
    FN-Greatermanchester - you are a star!! I've been looking at this for hours - guess I got to the stage where I couldn't see the wood for the trees!! Thanks again.

    Incidentally - do you know of a good reference (book or web site) for vbscipt coding that can be used in login scripts?

    Many thanks
    What are you wanting to do with a login script?

  11. #10

    mac_shinobi's Avatar
    Join Date
    Aug 2005
    Posts
    9,215
    Thank Post
    2,766
    Thanked 935 Times in 875 Posts
    Rep Power
    343

    computer performance

    Windows Logon Scripts - VBScript examples to create printers, map network drives

    VBScript Scripts | ScriptingAnswers.com Essentials

    Windows Management Script Center

    Windows Management Script Center

    drive space report : Drive Space Report (HTA)

    wisesoft website :

    VBScript,PowerShell,Batch File,KiXtart and HTA examples for system administration

    Plenty of resources out there I normally use computer performance website or the activexperts website ( the first walks you through a plathora of examples and how they work and points to note and the second gives you the examples on how to do different things )

    wisesoft has script examples as well.

    Short of that a google search should give you more

  12. #11

    Join Date
    Jun 2008
    Location
    Dorset
    Posts
    74
    Thank Post
    7
    Thanked 0 Times in 0 Posts
    Rep Power
    0
    Thaks for the scriptiong websites guys!! Will be spending a lot of time on them today!!

    FN-Greatermanchester - I am going to take all my staff PCs and laptops out of RM and just use RM for the students. For the age of my laptops, I am seeing a big overhead with RM running - coupled with the fact that I dont like the restrictions that RM applies.

    I am going to use just AD for managing staff, so need a login script for drive mapping and printer mapping etc.

    Will also use it for running any extra stuff as and when

  13. #12

    maniac's Avatar
    Join Date
    Feb 2007
    Location
    Kent
    Posts
    3,037
    Thank Post
    209
    Thanked 425 Times in 306 Posts
    Rep Power
    143
    Quote Originally Posted by brahma View Post
    Thaks for the scriptiong websites guys!! Will be spending a lot of time on them today!!

    FN-Greatermanchester - I am going to take all my staff PCs and laptops out of RM and just use RM for the students. For the age of my laptops, I am seeing a big overhead with RM running - coupled with the fact that I dont like the restrictions that RM applies.

    I am going to use just AD for managing staff, so need a login script for drive mapping and printer mapping etc.

    Will also use it for running any extra stuff as and when
    That's precisely what we do here. Tip from me, make sure you create a completely new OU for all your staff machines and users, and disable policy inheritance on it. That way you won't get any of the RM GPOs clogging up your setup. Also it's worth creating your own security groups as well, and not using the RM default ones, that way you know what they all do and can allocate them to resources as you feel necessary.

    Mike.

  14. #13

    Join Date
    Jun 2008
    Location
    Dorset
    Posts
    74
    Thank Post
    7
    Thanked 0 Times in 0 Posts
    Rep Power
    0
    Thanks Maniac - good tip.

  15. #14

    Join Date
    Jun 2008
    Location
    Dorset
    Posts
    74
    Thank Post
    7
    Thanked 0 Times in 0 Posts
    Rep Power
    0
    More Login Script agro!!

    I've got my network drives mapping spot on now but am having trouble wiht printers. I want to map a printer for a user based on group membership and have tried the following:

    If isMember("Printer_OFFICE1_2600N") Then
    WshNetwork.AddWindowsPrinterConnection "\\print-01\OFFICE1_2600N"

    Elseif isMember("Printer_RECEPTION_2300DTN") Then
    WshNetwork.AddWindowsPrinterConnection "\\print-01\RECEPTION_2300DTN"

    ElseIf isMember("Printer_FINANCE_OFFICE_2600N") Then
    WshNetwork.AddWindowsPrinterConnection "\\print-01\FINANCE_OFFICE_2600N"
    Endif

    I am using an account to test this that is only a member of "Printer_RECEPTION_2300DTN" but they get printer "\\print-01\OFFICE1_2600N" mapped and not reception!! I have put some wscript.echo commands in to see what is happening - I am getting an echo from Office1 and not from Reception - the script seems to map to the first printer - regardless of group membership - and then exits without testing the other If statements. Even tho' my user is not a member of Office they get the Office printer and even tho' they are a member of Reception they dont get the reception printer!!

    What am I doing wrong?

  16. #15

    SYNACK's Avatar
    Join Date
    Oct 2007
    Posts
    10,686
    Thank Post
    824
    Thanked 2,570 Times in 2,187 Posts
    Blog Entries
    9
    Rep Power
    731
    Quote Originally Posted by brahma View Post
    More Login Script agro!!

    I've got my network drives mapping spot on now but am having trouble wiht printers. I want to map a printer for a user based on group membership and have tried the following:

    If isMember("Printer_OFFICE1_2600N") Then
    WshNetwork.AddWindowsPrinterConnection "\\print-01\OFFICE1_2600N"

    Elseif isMember("Printer_RECEPTION_2300DTN") Then
    WshNetwork.AddWindowsPrinterConnection "\\print-01\RECEPTION_2300DTN"

    ElseIf isMember("Printer_FINANCE_OFFICE_2600N") Then
    WshNetwork.AddWindowsPrinterConnection "\\print-01\FINANCE_OFFICE_2600N"
    Endif

    I am using an account to test this that is only a member of "Printer_RECEPTION_2300DTN" but they get printer "\\print-01\OFFICE1_2600N" mapped and not reception!! I have put some wscript.echo commands in to see what is happening - I am getting an echo from Office1 and not from Reception - the script seems to map to the first printer - regardless of group membership - and then exits without testing the other If statements. Even tho' my user is not a member of Office they get the Office printer and even tho' they are a member of Reception they dont get the reception printer!!

    What am I doing wrong?
    Apart from assesing who is in what group you code is doing exactly what it is told to:

    Currently its excecution path is like this:
    If a member of Printer_OFFICE1_2600N then map printer else (if not a member) then check if user is a member of Printer_RECEPTION_2300DTN, if so map that printer, if not then check the next one.

    I think what you want to do is break up your if statments so that they are assessed individually:
    Code:
    If isMember("Printer_OFFICE1_2600N") Then WshNetwork.AddWindowsPrinterConnection "\\print-01\OFFICE1_2600N"
    
    If isMember("Printer_RECEPTION_2300DTN") Then WshNetwork.AddWindowsPrinterConnection "\\print-01\RECEPTION_2300DTN"
    
    If isMember("Printer_FINANCE_OFFICE_2600N") Then WshNetwork.AddWindowsPrinterConnection "\\print-01\FINANCE_OFFICE_2600N"
    You should echo the result of your isMember procedures to see which ones are being assessed as true.

SHARE:
+ Post New Thread

Similar Threads

  1. vbs logon with ie
    By box_l in forum Scripts
    Replies: 5
    Last Post: 11th August 2010, 11:35 PM
  2. Limit Logon VBS Version
    By ChrisH in forum Scripts
    Replies: 29
    Last Post: 17th August 2009, 02:47 PM
  3. small vbs help please
    By RabbieBurns in forum Scripts
    Replies: 4
    Last Post: 20th May 2008, 03:30 PM
  4. VBS Tutorial
    By Nij.UK in forum Coding
    Replies: 15
    Last Post: 25th November 2006, 12:01 AM
  5. running scrip when laptop connects to n/w
    By russdev in forum How do you do....it?
    Replies: 2
    Last Post: 5th September 2005, 11:45 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
  •