Jump to content

Importing keys during specific user's first logon


Speeddymon
 Share

Recommended Posts

Hi

Situation: Want to import keys to a specific user's hive on initial login with that user.

Question: If I create $OEM$\$Docs\Tom\Start Menu\Programs\Startup on my install disc, will Windows still put the user profile in Documents and Settings\Tom or will it do Documents and Settings\Tom.COMPUTERNAME ?

I'm thinking that it will do the latter, and so therefore any batch file I put in there to import a key will be ignored, but I want to know for sure before I just go and test it by making my iso and using ms virtual pc...

Link to comment
Share on other sites


So, what you're looking to do is import Current User keys but only for specific users, right?

Put the logic into the login script (or Startup script, your choice). Basically, if "Tom" import the keys, otherwise don't (IF %USERNAME% = Tom...).

One script that runs for everyone, but has the ability to only affect specific users. Just drop it in the All Users startup group and you're good to go.

Edited by mmarable
Link to comment
Share on other sites

Did you try putting it in the "startup" folder of the Default User profile? You need to show hidden & system files in order to even see the Default User profile.

Edited by core22
Link to comment
Share on other sites

Hmmmm my problem is looking the same.

Is it possible to run some file only at the first logon for each specific user ??

The reason I'm asking this is because I want to install MS Office for all users, and have different PRF files (outlook settings) for each user. It would be nice to run this PRF file the first time a user logon.

Maybe somebody got this problem solved already and is willing to post a little bit of help (and a example of how it is done ?).

Thanks in Advance,

NL President

...........The Only Fear Is Running Out Of Beer......................

Link to comment
Share on other sites

My problem was ridding the desktop of the Media Player icon that shows up again after sysprepping. I did the following...the 2 files below are part of my sysprepped image...

RunOnce.bat

(located in C:\Documents and Settings\Default User\Start Menu\Programs\Startup)

start %windir%\NoMP.bat

NoMP.bat

(located in C:\Windows)

Del "c:\Documents and Settings\%USERNAME%\Desktop\Window*.lnk"
Del "C:\Documents and Settings\%USERNAME%\Start Menu\Programs\Startup\RunOnce.bat" /f /q
exit

RunOnce.bat gets copied into User A's startup folder and executes. It calls NoMP.bat, which removes the icon then deletes the RunOnce.bat from the currently-logged-in user (User A). The original RunOnce.bat in Default User's startup still remains for anyone new who will logon.

-Corey

Edited by core22
Link to comment
Share on other sites

Well I went ahead and tested it, it made a separate profile folder named Tom.COMPUTERNAME. So, how do I get something to be put into the profile for running either on first logon, or afterward?

This happens probably because the user Tom dirs you specified were created very early on (in Text Mode) and later Setup thought the ones you created were old and made new ones besides the old, appending the computername to them. This would be the case during install when you choose not to delete the old user folders.

Why not try GuiRunOnce? Items there would run when a user first logs on.

My method also works:

use cmdlines.txt to run a cmd to move your reg from a location (say $OEM$\$1) to your desired userprofile and autologon using that same user.

EDIT: corrected, should be $OEM$\$1

Edited by Takeshi
Link to comment
Share on other sites

Why not try GuiRunOnce? Items there would run when a user first logs on.
The problem with that is that I have Administrator set to logon the first boot into real windows, so it applies to Administrator, which I don't want.
My method also works:

use cmdlines.txt to run a cmd to move your reg from a location (say %OEM%\$1) to your desired userprofile and autologon using that same user.

Could you provide a code sample?

Link to comment
Share on other sites

Do you really need to logon first with Administrator?

winnt.sif: leave these blank to disable autologon with Administrator.

[GuiUnattended]
AutoLogon =
AutoLogonCount =

With cmdlines.txt, use useraccounts.cmd to create a new user and autologon.reg for this user, then it won't logon using Administrator.

Put <filename>.cmd in $OEM$\$1 to be moved during setup.

move.cmd (same place as cmdlines.txt)

[code all in one single line]
@echo off
move /y "%SystemDrive%\<filename>.cmd" "%Userprofile%\Start Menu\Programs\Startup"

$OEM$\cmdlines.txt should have:

"useraccounts.cmd"
"move.cmd"

====================

EDIT Some problems with this: see #13 my further reply.

Edited by Takeshi
Link to comment
Share on other sites

Hmmmm my problem is looking the same.

Is it possible to run some file only at the first logon for each specific user ??

The reason I'm asking this is because I want to install MS Office for all users, and have different PRF files (outlook settings) for each user. It would be nice to run this PRF file the first time a user logon.

Your problem is the easiest to solve since you want to apply the settings to each user.

You can import a reg key to HKCU\Software\Microsoft\Windows\CurrentVersion\RunOnce

at T-13 or T-12.

Importing the reg key at T-13 or T-12 makes it stick for all computer users,

either those have been created already or those will be created in the future.

The reg key will be run only once, exactly as you need it to be.

The reg key is supposed to run whatever code you want; like COPY, REG ADD, etc.

Not to double posting, please read this for more information.

@ Takeshi

Your suggestion is excellent.

Link to comment
Share on other sites

Thanks mazin!

Actually, on further scrutiny, using cmdlines.txt would in fact import move.cmd to the Default User Profile and hence to every user who subsequently logs on. So I can't see any other way to make it apply to only one user unless you use GuiRunOnce. Forget about cmdlines.txt for this.

If you first logon as Tom, as I outlined above, then it should be fine.

If you first logon as Administrator, you can still use GuiRunOnce, but this time use it to move the cmd to Tom's user dir rather than executing it directly. So when Tom logs on later, it runs.

See how that goes...

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.


×
×
  • Create New...