/build/static/layout/Breadcrumb_cap_w.png

Software Question


Run .cmd file each time a user logs in

02/20/2018 1042 views
I have a .cmd file that i created that will add some lines to the Registry Editor. However the changes i need have to be done to the HKey_Current_User folder only. Is there a way to set up a scripting job, or distribution, or something else that i can do, that will run this file every time someone logs into the device? Beginning user here and just getting used to the system. Would appreciate any advice or help available. 
Answer Summary:
1 Comment   [ + ] Show comment

Comments

  • You can try to setup Run key and put data containing command line to run *.cmd file.

    You'll find Run key at HKCU\Software\Microsoft\Windows\CurrentVersion

    It'll run for every user at logon.

Answer Chosen by the Author

2
There are a couple of ways you can approach this. 
The easiest way would be to drop the script in the Windows start menu Startup folder. 
Create a scheduled task to run at login that runs the script.
Add a registry entry in HKLM\Software\Microsoft\Windows\CurrentVersion\Run to run the script.
Here's a script that I wrote which will import a .reg file into the default user hive and every profile on the system:
@echo off
echo Updating default user profile
reg load HKU\Def c:\users\default\ntuser.dat
regedit /s settings.reg
reg unload HKU\Def
for /D %%u in (\Users\*) do (
echo Updating options for %%u
reg load HKU\Def %%u\ntuser.dat
regedit /s settings.reg
reg unload HKU\Def
)
echo All Done here
Place the required registry keys in a file named settings.reg and change the HKEY_CURRENT_USER to HKEY_USERS\Def.

In terms of KACE scripting, Offline KScripts have the option for "Also execute after login" but I'm not certain if that will run the script at every login or not. 
Answered 02/21/2018 by: chucksteel
Red Belt

Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login

View more:

Share

 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ