sam240 Posted August 16, 2016 Share Posted August 16, 2016 I'm trying to figure out what is the best way to run this reg on computers just once after log on. The problem is my imaged computers popup "Library" window every time a user logs into windows and this registry below fixes it. I have this in a batch file but how can I run it only once on the machine after logon? I know I can use Task Scheduler but Task Scheduler doesn't give me the option to run it only once and same with group policy. reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v Userinit /t REG_SZ /d "C:\Windows\system32\userinit.exe," /t I appreciate your help. Link to comment Share on other sites More sharing options...
sam240 Posted August 17, 2016 Author Share Posted August 17, 2016 21 hours ago, sam240 said: I'm trying to figure out what is the best way to run this reg on computers just once after log on. The problem is my imaged computers popup "Library" window every time a user logs into windows and this registry below fixes it. I have this in a batch file but how can I run it only once on the machine after logon? I know I can use Task Scheduler but Task Scheduler doesn't give me the option to run it only once and same with group policy. reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v Userinit /t REG_SZ /d "C:\Windows\system32\userinit.exe," /t I appreciate your help. Well I was able to figure it out on my own. In case someone needs it. I created a batch file and added it to Local C:\support\fix.bat (I created a support folder) To only run once, open regedit goto HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce Create a new string and name it whatever you like and in DATA field, add the path to the batch file which in my case is C:\support\fix.bat and that worked like a charm. It automatically gets removed from registry after it runs so it does not run over and over again. @echo off SET FLAG=%TEMP%\Flag.txt IF EXIST %FLAG% GOTO END reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v Userinit /t REG_SZ /d "C:\Windows\system32\userinit.exe," /t > %FLAG% :END Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now