Jump to content

Run commands once on each new user logon


Recommended Posts

Sorry, being a bit think here, but how can I envoke an application on first logon for each new user? This is after an unattended install, and following an admin adding a new user, and that user then logs in.. Want a kind of RunOnceEx in the default current user hive... but that doesn't work :(

Note the application is the Nvidia desktop Manager. Want it to automatically be enabled for all users in the system without their intervention. Commands are from here:

http://www.msfn.org/board/nVidia_Drivers_D...ion_t96836.html

but are basically:

rundll32.exe nview.dll nViewCmd pon
rundll32.exe nview.dll nViewCmd loadprofile dualview all

Thanks,

Chris

Link to comment
Share on other sites


After some more searching found this thread:

http://www.msfn.org/board/RunOnceEx_regist...ded#entry374611

RunOnceEx is not available in Current User, only in Local Machine.

I've got round my problem by creating a batch file with the commands above and sticking a short-cut link in the default users profile. At the end of the batch file the short-cut is deleted.

Running the above from RunOnce cause problems as suppose they need the explorer shell to exist.

Anyways, all the answers are in this forum, if you know where to look :)

Thanks..

Edited by cocjh1
Link to comment
Share on other sites

  • 3 weeks later...

This method seems to work well enough for me.

1) So through RunOnceEx.cmd, i load the following cmd

REG ADD %KEY%\990 /VE /D "Tuning User Environments" /f

REG ADD %KEY%\990 /V 1 /D "RunHiddenConsole /w \"H:\temp\User Configuration\User Configuration at SU.cmd\"" /f

2) this command loads the default user with

:: cmdow @ /HID

@echo off

SET HKUC=HKEY_USERS\Custom\Software\Microsoft\Windows\CurrentVersion\RunOnce

:: Load HKU with Default User profile

REG LOAD HKEY_USERS\Custom "%HomeDrive%\Documents and Settings\Default User\NTUSER.dat"

REG ADD "%HKUC%" /v "pg_00" /t REG_EXPAND_SZ /d "\"H:\temp\User Configuration\User Configuration at SU.exe\"" /f

:: UnLoad HKU of Default User profile

REG UNLOAD HKU\Custom

EXIT

3) the User Configuration at SU is a compiled AU3 script that uses a case statement to customize for username

; ----------------------------------------------------------------------------

; AutoIt Version: 3.1.1

; Language: English

; Platform: Win9x/NT

; Author:

;

; Script Function:

; Configures Office per User at User Startup

;

; ----------------------------------------------------------------------------

HotKeySet("^!x", "MyExit")

; Script Start - Add your code below here

; ----------------------------------------------------------------------------

; Configure Office per User at User Startup

; Toggle Rate

$i = 500

Sleep($i)

Select

Case @UserName = "Administrator"

; Do Nothing

Case @UserName = "User1"

SplashTextOn("Active Processes", "office-User2", 200, 100, 0, 150, 4, "", 9)

Sleep(1000)

SplashOff()

RunWait(@ScriptDir & "\office-User2\Config & Files Placement.exe")

Sleep($i)

Case @UserName = "User2"

SplashTextOn("Active Processes", "office-User2", 200, 100, 0, 150, 4, "", 9)

Sleep(1000)

SplashOff()

RunWait(@ScriptDir & "\office-User2\Config & Files Placement.exe")

Sleep($i)

Case @UserName = "User3"

SplashTextOn("Active Processes", "office-User3", 200, 100, 0, 150, 4, "", 9)

Sleep(1000)

SplashOff()

RunWait(@ScriptDir & "\office-User3\Config & Files Placement.exe")

Sleep($i)

Case @UserName = "User4"

SplashTextOn("Active Processes", "office-User4", 200, 100, 0, 150, 4, "", 9)

Sleep(1000)

SplashOff()

RunWait(@ScriptDir & "\office-User4\Config & Files Placement.exe")

Sleep($i)

Case Else

; Do Nothing

EndSelect

;Sleep($i)

; ----------------------------------------------------------------------------

; Place functions here

; ----------------------------------------------------------------------------

Func MyExit()

Exit

EndFunc

; ----------------------------------------------------------------------------

Link to comment
Share on other sites

RunOnceEx cannot do this... I use something similar with my Sidebar addon

HKLM,"SOFTWARE\Microsoft\Active Setup\Installed Components\{D58F39FF-953E-4F45-898F-59F243B9A523}",,0,"Windows Sidebar"
HKLM,"SOFTWARE\Microsoft\Active Setup\Installed Components\{D58F39FF-953E-4F45-898F-59F243B9A523}","ComponentID",0,"sidebar.EXE"
HKLM,"SOFTWARE\Microsoft\Active Setup\Installed Components\{D58F39FF-953E-4F45-898F-59F243B9A523}","IsInstalled",0x00010001,01,00,00,00
HKLM,"SOFTWARE\Microsoft\Active Setup\Installed Components\{D58F39FF-953E-4F45-898F-59F243B9A523}","Locale",0,"US"
HKLM,"SOFTWARE\Microsoft\Active Setup\Installed Components\{D58F39FF-953E-4F45-898F-59F243B9A523}","StubPath",0x00020000,"RUNDLL32 advpack.dll,LaunchINFSection %INF_FILE%,Register"
HKLM,"SOFTWARE\Microsoft\Active Setup\Installed Components\{D58F39FF-953E-4F45-898F-59F243B9A523}","Version",0,"6,0,6001,16659"

You can probably use something similar, this stays in the registry (unlike ROEx) and each time a new user is created then this command is executed

Just go to this location in the registry export and mod any key, you change the GUID and command (StubPath) and any other stuff you think necessary

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Active Setup\Installed Components

Edited by ricktendo64
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...