Login Script - and CLIENTNAME reference

Answered Login Script - and CLIENTNAME reference

  • Thursday, October 04, 2012 6:37 AM
     
     

    Hi

    I want my login . logout handling for all users on a machine to record who is on the machine and the source location.

    Context : Remote Desktop

    When you remote desktop, environment variable CLIENTMACHINE is set, unfortunately this is NOT set when the group policy login / logout scripts are run, only some time later..

    CLIENTMACHINE  records the name of the source machine doing the remote desktop.

    I found an article http://social.technet.microsoft.com/Forums/en-US/winserverTS/thread/1921fbdf-74db-4252-8d94-a2b3db7707dd which seemed to resolve this but i find Windows 7 does not have a "Run these programs at user logon" setting !

    >> Is there another way to run a login script for all users which occurs AFTER the remote desktop login on Windows 7 ?  (NB: this is a login issue, not startup)

    Thanks!!

All Replies

  • Friday, October 05, 2012 3:56 AM
    Moderator
     
     Answered

    Hi,

    You can create a runonce script.

    Run and RunOnce Registry Keys
    http://msdn.microsoft.com/en-us/library/aa376977(v=vs.85).aspx

    How to Create a Runonce Script
    http://www.ehow.com/how_5175782_create-runonce-script.html

    Or create a schedule task for windows 7 and set the trigger to startup.

    Niki
    TechNet Subscriber Support
    If you are TechNet Subscription user and have any feedback on our support quality, please send your feedback here.

     


    Niki Han

    TechNet Community Support

    • Marked As Answer by Greg B Roberts Sunday, October 07, 2012 6:07 AM
    •  
  • Friday, October 05, 2012 6:09 AM
     
     

    Thanks

    I will trial the runonce approach to see that it works wrt. CLIENTNAME and post back

    On the Scheduled Task, front, i see there is a "connect to user session", i will try this as well.

    regards

  • Sunday, October 07, 2012 6:07 AM
     
     Answered

    The results were interesting,

    Using the RUN from the registry worked and showed the CLIENTMACHINE

    Group policy login does not show CLIENTMACHINE and occurs AFTER the registry setting

    The Schedule task option also did not have a value for CLIENTMACHINE and also i could not get it to run, using the "on connection to user session" option. A manual run of the tasked showed no CLIENTMACHINE value

    => SO the tip that works is the registry RUN option (note in my test i used the HKEY_LOCAL_MACHINE area, not sure if any functional difference to the HKEY_CURRENT_USER)

    CHeers