4 Replies Latest reply on May 31, 2011 1:53 PM by Catalysttgj

    Running script once for each logged on user


      I am somewhat new to LanDesk but have used SCCM and Altiris in the past.

      I am wondering how I can get a VBscript to run once for each logged on user. Something both Altiris and Sccm did seemlessly.

      For example, when install office there are certain reg keys I would like to modify in the HKCU hive. I need this to run once for each logged on user no matter if they have a profile on that machine or not.  Any and all help is appreciated.



        • 1. Re: Running script once for each logged on user
          zman Master



          Welcome. There are many ways to handle this:

          1. Create a Required, Run Once Policy and have a user based target (e.g., LDAP user group). This will run once per user per machine. Make sure the distribution package is set to run in the user context.
          2. GPO. Most of the Office user settings can be set ia GPO or custom ADMX file.
          3. Modify the C:\Documents and Settings\Default User\ntuser.dat default user profile. Good for new profiles.
          4. Use Autoscript or other scripting language to run the script against all user profiles on the machine - use in combination with 2. I have autoitscript to do this.
          5. Dump the script locally and place in the "C:\Documents and Settings\Default User\Start Menu\Programs\Startup" group. - hard to control and will run all the time.
          6. Local scheduled task that will run when the user logs in

          LocalSch.exe /exe=%ProgramFiles%\LANDesk\LDClient\startasuser.exe" /cmd="c:\scripts\vb.script" /taskid=1001  /freq=600 /toe=logon /user


          So I provided a lot of options with the easiest first.  5 is interesting since it does not require a lot of load on the core, is queryable in the inventory, etc... Hope this helps.

          Please consider voting for these ERs:
          Query Builder Import
          Provide bulk client deletions without carpal tunnel syndrome.
          Core Synchronization Allow Mirror functionality from Master Core

          • 2. Re: Running script once for each logged on user
            Catalysttgj Expert

            We use a combo approach of Zman's 3. and 4., except ours is a winbatch compiled executable that we can pass an HKCU reg file that will then get added to every profile existing on the machine including "Default user" for future profiles, and excluding undesired profiles. This utility is part of any package that needs HKCU values added, so that all the work is done in one hit. Works great, and eliminates the messy approach of running things all the time.

            • 3. Re: Running script once for each logged on user

              question.. in order to add hkcu reg files to every non-logged on user profile do you have to modify each S-#-#-## entry in the HKEY_USERS hive or do you have to load each ntuser.dat and make the modification there?

              • 4. Re: Running script once for each logged on user
                Catalysttgj Expert

                You kinda need to do both, but not every SID in the HKEY_USERS. There's going to be some that you don't want to fool with like the built-in admin account and such (well maybe you do want to edit those, but be very careful doing that!), but the ones that are definitely user related, yes. Basically, if a user is logged in then they appear in HKEY_USERS. If they are logged in, then you can't load the ntuser.dat, since its already in use and loaded, so you wanna edit it where it is already loaded. Otherwise, you can load any ntuser.dat (not already loaded) to whatever name you wanna call it, and then make the edits. In our case, we just made a loop that would load each ntuser.dat to a generic path, then plug in the values to that specific path. Since the path is always the same, makes it pretty simple. Then when done editing, unload that hive and go on to the next. Repeating the edit process again.


                Hope that helps ya.