MaelstromX Posted March 12, 2006 Share Posted March 12, 2006 I have been playing around on my test network and making some improvements (aesthetic and functional).Normally in my domains logon scripts I have a main script that calls smaller "function" scripts. This way I keep my code organized and easy to edit.While perusing the Unattended setup page for some silent installer info I saw the section on RunOnceEX and thought to myself why cant I use this to make my logon scripts more user friendly and pretty". Well, it was actually easier than I thought. Here is what I did.As I said before my logon script is composed of a "main" script and 3 "function" scripts. All are simple because I am redesigning my network at the moment and adding new features. Here is what my GlobalLogon.cmd used to look like.@echo off:::: This is the core logon script for the test.net domain.:: It launches all other logon scripts.:::START:::: Start of Script. Sets Variables.::SET logpath=\\test.net\NETLOGON:CALLS:::: Logon sub-scripts are called here.::START "Setting default command prompt path to drive root" /I /WAIT %logpath%\Cmd.cmdSTART "Mapping network drives" /I /WAIT %logpath%\MapDrives.cmdSTART "Adding BGinfo information to your background" /I /WAIT %logpath%\BGinfo.cmd:PAUSE:::: Pause for debugging (disabled by default)::::pause:END:::: End of script::EXITUsing some information from http://unattended.msfn.org/unattended.xp/view/web/31/ I converted the central 3 calls to REG ADD entries. Normally the computer will wait until it restarts to run registry values added here so I had to find a way to manually launch the RunOnceEX process.the solution is to add your values to the registry and use this line of code.rundll32.exe iernonce.dll,RunOnceExProcessI still wanted the functions to be run in their own .cmd scripts. So I just used the RunOnceEX to launch these command separately like I was doing in my original. This was however, quite ugly, and the whole point of this was to neaten up the look of things. So I found a small window hiding program called Hidec.exe and added it in to each line.Here is my new improved GlobalLogon.cmd@echo off:::: This is the core logon script for the test.net domain.:: It launches all other logon scripts.:::START:::: Start of Script. Sets Variables.::SET logpath=\\test.net\NETLOGONSET KEY=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx:RUNONCE:::: Adds items to Runonce to be used for the logon script::REG ADD %KEY% /V TITLE /D "Running Logon Scripts" /fREG ADD %KEY%\005 /VE /D "Setting default command prompt path to drive root" /fREG ADD %KEY%\005 /V 1 /D "%logpath%\hidec /w %logpath%\Cmd.cmd" /fREG ADD %KEY%\010 /VE /D "Mapping network drives" /fREG ADD %KEY%\010 /V 1 /D "%logpath%\hidec /w %logpath%\MapDrives.cmd" /fREG ADD %KEY%\015 /VE /D "Adding BGinfo information to your background" /fREG ADD %KEY%\015 /V 1 /D "%logpath%\hidec /w %logpath%\BGinfo.cmd" /frundll32.exe iernonce.dll,RunOnceExProcess:PAUSE:::: Pause for debugging (disabled by default)::::pause:END:::: End of script::EXITWorks like a charm. Hope this is helpful to some people.I attached a .jpg for those of you who want to see the results. Link to comment Share on other sites More sharing options...
jftuga Posted March 13, 2006 Share Posted March 13, 2006 What is the difference between RunOnce and RunOnceEX?-John 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