Results 1 to 2 of 2

Thread: Running a batch from running folder on user login

  1. #1
    avisht is offline Getting Started on GPanswers.com
    Join Date
    Dec 1969
    Posts
    3

    Default

    Hi all,
    I'm a little bit new with these GPO stuff...

    How am i forcing to executing a batch with a user login to the domain?

    The execution file must be run with a working folder. So where do i need to place the folder and its files ?
    How do i forcing the batch to run every time a user login to the domain and is it possible to do it only on users first login ?

    Thanks !

  2. #2
    AdamV is offline 100+ Helpful Posts! 50+ Helpful Posts
    Join Date
    Dec 1969
    Posts
    669

    Default

    How far have you got with this? which bit are you stuck on?

    You can easily create a batch file and then define this as the user's logon script in a group policy, if that is what you want to do.

    As to running only at first logon, there's nothing native in GP to set that, but you could easily do this within your batch file by creating a file on the system when the script completes, and testing for the existence of this file at the begining of the script.

    [code:1]
    IF exist c:\flags\MyFlag.flg goto END

    foo
    bar
    more script stuff

    echo %username% > c:\flags\MyFlag.flg
    net time \\%computername% >> c:\flags\MyFlag.flg
    :END
    [/code]

    If you need it to run once per user on each machine they log onto, you could vary this to create a flag file unique to the user (by name, or maybe putting the flag in the user's profile).

    If you only want it to run once for the user ever, then you need to write the flag to a share they can always see (their home drive would be a prime candidate for this)

    It all depends on what you really want to achieve.

Posting Permissions

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

Search Engine Friendly URLs by vBSEO