create logon script
Page 1 of 2 12 LastLast
Results 1 to 10 of 19

Thread: create logon script

  1. #1
    Senior Member
    Join Date
    Jun 2004
    Posts
    281

    create logon script

    Well I need your expertise again.

    I need to know how to create a logon script for Windows 2003 Server. I searched online for awhile and found an example of how to map a drive in logon. However, I am wondering how to:

    1. - Modify users environment variables (is there a way I can give each user their personal desktops through a logon script.

    2. - Map multiple drives.

    Here is the example of mapping a drive through a logon script:

    Dim objNet

    Set objNet = CreateObject("Wscript.Network")

    objNet.MapNetworkDrive "F:", "\\servername\drive"
    WSCript.Quit
    ' End of Script
    Please help I will be searching the net but I would like first hand info.

    - MilitantEidolon
    Yeah thats right........I said It!

    Ultimately everyone will have their own opinion--this is mine.

  2. #2
    Senior Member
    Join Date
    Feb 2002
    Posts
    130
    Map multiple drives?

    I am more a fan of using batch file for simple things like this rather than over complicating things with vbscript. To map a network drive use the 'net use' command

    eg

    net use x: \\severname\%username%

    to map a drive called x: to a share on a server with the same name as the username of the user.

    or just net use z: \\servername\sharename

    for a normal UNC path

    Save the file as a .bat file and you are away, apologies if I have made any mistakes but can't get Windows working at the moment.

    I suppose you could also use the %username% variable to distinguish between users when they log on and change their desktop accordingly, would have to get my MS box back up to try that sort of thing out

  3. #3
    Senior Member
    Join Date
    Jun 2004
    Posts
    281
    UKnetSec

    Thank you for the quick response. How would I integrate that into 2003 Active Directory? Would I just save it as a .bat and run it at logon.

    Map multiple drives?
    Yeah we have to drives our users logon to and I would need to logon to multiple drives.

    I also need to be able to load some icons onto the desktop at startup and would like to know that!

    - MilitantEidolon
    Yeah thats right........I said It!

    Ultimately everyone will have their own opinion--this is mine.

  4. #4
    Senior Member
    Join Date
    Feb 2002
    Posts
    130
    In group policy you can specify a logon script for different users groups etc, just make a batch file on the server and tell it to use that.

    Multiple drives ? no problem

    create a batch file with this in it :

    net use x: \\server\share
    net use z: \\server\share2

    etc etc

    I take it you mean you want different icons for each user else you could just put them in the all users desktop folder.

  5. #5
    Senior Member
    Join Date
    Jun 2004
    Posts
    281
    I was hoping that I could just make it a network wide change when adding the icon instead of doing it computer by computer! I know it is possible but the answer is getting harder to find.
    Yeah thats right........I said It!

    Ultimately everyone will have their own opinion--this is mine.

  6. #6
    Senior Member
    Join Date
    Feb 2002
    Posts
    130
    no it isn't hard

    I will admit VBscript is probably better for this one add a shortcut to a users desktop using this


    Set wshObject = Wscript.CreateObject("Wscript.Shell")
    desktopFolder = wshObject.SpecialFolders("Desktop")
    set myShortcut = wshObject.CreateShortcut(desktopFolder & "\Notepad.lnk")
    myShortcut.TargetPath = "%windir%\Notepad.exe"
    myShortcut.Save()

    This creates a shortcut on the desktop called Notepad which links to notepad.exe in the winnt\system32 dir or the windows\system32 directory depending on your system.

    straight out of a book called "learn VBscript in a weekend"

    Just replace "\Notepad.lnk" with the name you want your link to have

    and

    "%windir%\notepad.exe" with the path to the program or whatever you want the shortcut to point to.


    If you want to do this in a batch file instead you can use a tool called shortcut.exe which is in the NT resource kit, if you can find it , an article describes that method

    here

  7. #7
    Senior Member
    Join Date
    Jun 2004
    Posts
    281
    Alright, I can run both batch and vbscripts on the same login? Or should I go with basic batch all the way?

    I would also like to double check on where I load up the logon script. It is loaded in the Group Policy Object Editor (in 2003 server) / user configuration / scripts?


    - MilitantEidolon
    Yeah thats right........I said It!

    Ultimately everyone will have their own opinion--this is mine.

  8. #8
    Senior Member
    Join Date
    Feb 2002
    Posts
    130
    To keep things tidy I would probably use VBscript all the way in this one, just because I think thats the best way of doing the shortcuts in this case and I would try and keep it to just one logon script. If it was just mapping a couple of drives I would stick to batch files. Keep in mind though that all your clients nned to have Windows Scripting Host (WSH) to make this work, because that is what interprets the VBscript, so 2000/XP boxes should be fine but older ones may either have no WSH or an old version which may not do what you expect. If you have 95/98/ME boxes then you may have to look at something else maybe worth checking out kixtart http://www.kixtart.org/ . They have extensive docs on their site, basically you put the kixtart exe (interpreter) on the server share and the clients run it from there, worth a look.

    Yes you can either set up the scripts there and apply them to OUs through group policies or I believe you can do it in 'active directory users and groups' through users properties etc. I suppose the Group Policy way makes it easier in this case though.

  9. #9
    Senior Member
    Join Date
    Jun 2004
    Posts
    281
    I never really use VBScript so I am not sure how I should create on script to control both functions would it be something like:

    [QUOTE]

    Dim objNet

    Set objNet = CreateObject("Wscript.Network")

    objNet.MapNetworkDrive "F:", "\\servername\drive"
    WSCript.Quit

    Set wshObject = Wscript.CreateObject("Wscript.Shell")
    desktopFolder = wshObject.SpecialFolders("Desktop")
    set myShortcut = wshObject.CreateShortcut(desktopFolder & "\Notepad.lnk")
    myShortcut.TargetPath = "%windir%\Notepad.exe"
    myShortcut.Save()

    end of script
    [QUOTE]

    How would I compile it. I need to DL a VB editor.


    - MilitantEidolon
    Yeah thats right........I said It!

    Ultimately everyone will have their own opinion--this is mine.

  10. #10
    AO Ancient: Team Leader
    Join Date
    Oct 2002
    Posts
    5,197
    You'll need to make sure all the clients are running at least IE 5.5 I believe it is to be sure the scripts don't error out. Other wise you'll have to dig around and find the appropriate windows scripting host (?) for those machines that error out on the script. I had that problem when I sat up some login script to inventory the network. Only half the machines worked. After investigating the common factor was IE 5.0. Upgrading to 6.0 or 5.5 made them work.
    Don\'t SYN us.... We\'ll SYN you.....
    \"A nation that draws too broad a difference between its scholars and its warriors will have its thinking done by cowards, and its fighting done by fools.\" - Thucydides

Posting Permissions

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