Jump to content

Run a command on a new user logon


Recommended Posts

Hi,

I'm looking for the solution on my problem. I need to run a batch script with menu start small icons fix on every new user first logon(before explorer runs). It works great with guirunonce from winnt.sif, but only for 1 user.

It there a way to modify windows installation source?

Regards

Link to comment
Share on other sites


Well, if you installing new comp, you'll be better with hkcu.reg started at T-12 of windows setup, but if it is already installed, than you can make some tweaks on Default User. I'll will explain both methods.

In root of your install CD, make folder named $OEM$. Than, inside this folder create file named cmdlines.txt, with, for example this inside:

[COMMANDS]

"useraccounts.cmd"

"REGEDIT /S hkcu.reg"

"RunOnceEx.cmd"

You see this hkcu.reg? This is the file where you can enter all fixes, modifications, etc. for all new users. Some examples:

; Use Large (48) Icons

[HKEY_CURRENT_USER\Control Panel\Desktop\WindowMetrics]

"Shell Icon Size"="48"

"IconSpacing"="-1320"

"IconVerticalspacing"="-1320"

; CMD Prompt Enhancements: Tab key completes path + filenames, UNC checks off

; Set an exotic Command Prompt colour First value is background second is foreground eg. 0000000a = light green on black

; 0=black 8=grey

; 1=blue 9=light blue

; 2=green a=light green

; 3=aqua b=light aqua

; 4=red c=light red

; 5=purple d=light purple

; 6=yellow e=light yellow

; 7=white f=bright white

[HKEY_CURRENT_USER\Software\Microsoft\Command Processor]

"CompletionChar"=dword:00000009

"PathCompletionChar"=dword:00000009

"DisableUNCCheck"=dword:00000001

"EnableExtensions"=dword:00000001

"DefaultColor"=dword:0000000a

; Shortcuts without "Shortcut to.."

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer]

"link"=hex:00,00,00,00

; Disable the Desktop Cleanup Wizard

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Desktop\CleanupWiz]

"NoRun"=dword:00000001

; Start Menu and Folder View

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced]

"HideFileExt"=dword:00000000

"NoNetCrawling"=dword:00000000

"ClassicViewState"=dword:00000000

"ShowSuperHidden"=dword:00000000

"DisableThumbnailCache"=dword:00000001

"PersistBrowsers"=dword:00000000

"WebViewBarricade"=dword:00000000

"FolderContentsInfoTip"=dword:00000001

"FriendlyTree"=dword:00000001

"Start_ShowNetPlaces"=dword:00000001

"Start_ShowNetConn"=dword:00000002

"Start_MinMFU"=dword:00000006

"Start_EnableDragDrop"=dword:00000001

"Start_ShowSearch"=dword:00000001

"Start_ShowMyDocs"=dword:00000001

"Start_ShowRun"=dword:00000001

"Start_ShowHelp"=dword:00000001

"Start_ShowMyPics"=dword:00000001

"StartMenuFavorites"=dword:00000002

"Start_ShowMyMusic"=dword:00000001

"Start_ShowControlPanel"=dword:00000001

"Start_ShowMyComputer"=dword:00000001

"Start_ScrollPrograms"=dword:00000000

"Start_ShowPrinters"=dword:00000001

"Start_ShowRecentDocs"=dword:00000002

"Start_AutoCascade"=dword:00000001

"Start_AdminToolsRoot"=dword:00000000

"StartMenuAdminTools"=dword:00000000

"Start_LargeMFUIcons"=dword:00000001

This last one is what your looking for?

Second method, if OS is already installed. First, create newuser.cmd in Windows folder. than open cmd prompt and execute this commands:

1. reg load HKU\Temp "%USERPROFILE%\..\Default User\NTUSER.DAT"

2. reg add "HKU\Temp\Software\Microsoft\Windows\currentVersion\RunOnce" /v NewUser /t REG_EXPAND_SZ /d %%SYSTEMROOT%%\newuser.cmd /f

3. reg unload HKU\Temp

Hope this helps...

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...