Results 1 to 4 of 4

Thread: Windows Logon Script

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2007
    Posts
    2

    Windows Logon Script

    I have the following batch file that I use to map drives. I need to change this to vbscript as a number of users that need to use it have had the command prompt disabled. I have no experience at all with VB so could someone translate this for me:

    Code:
    if exist \\server1\folder1\%username%\*.* goto NET
    if exist \\server1\folder2\%username%\*.* goto NET
    if exist \\server2\%username%$\*.* goto NET2
    goto DONE
    
    :NET
    net use /persistent:no
    net use k: "\\server1\Shared Area 1"
    net use p: \\server1\Admin1
    net use t: \\server1\Admin2
    net use w: "\\server1\Shared Area 2"
    goto DONE
    
    :NET2
    net use /persistent:no
    net use k: "\\server1\Shared Area 1"
    net use w: "\\server1\Shared Area 2"
    goto DONE
    
    :DONE
    exit
    Many thanks for your help.

  2. #2
    PowerPoster
    Join Date
    Feb 2006
    Location
    East of NYC, USA
    Posts
    5,691

    Re: Windows Logon Script

    ShellExecute the .bat file.
    The most difficult part of developing a program is understanding the problem.
    The second most difficult part is deciding how you're going to solve the problem.
    Actually writing the program (translating your solution into some computer language) is the easiest part.

    Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.

    Please Help Us To Save Ana

  3. #3

    Thread Starter
    New Member
    Join Date
    Jan 2007
    Posts
    2

    Re: Windows Logon Script

    Wouldn't this way still run the batch in command prompt? As mentioned im my previous post a number of users have command prompt disabled, so when the batch is run the message 'The command prompt has been disabled by your administrator. Press any key to continue...' and the batch file is not run.

    Thanks

  4. #4
    PowerPoster
    Join Date
    Feb 2006
    Location
    East of NYC, USA
    Posts
    5,691

    Re: Windows Logon Script

    I don't know if that disables the prompt itself (the "DOS box") or if it keeps cmd.exe from running. Since I'm not admin of this computer I can't change things to check it out, but maybe you have a computer you can try it on.

    Otherwise, If Dir("\\server1\folder1\%username%\*.*") > ""
    will simulate your if exist lines, but you'll have to get help on the net use lines from someone else.
    The most difficult part of developing a program is understanding the problem.
    The second most difficult part is deciding how you're going to solve the problem.
    Actually writing the program (translating your solution into some computer language) is the easiest part.

    Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.

    Please Help Us To Save Ana

Posting Permissions

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



Click Here to Expand Forum to Full Width