Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Login script for Default user profile in Windows 7

Posted on 2011-04-20
9
Medium Priority
?
1,008 Views
Last Modified: 2012-05-11
I am wanting to create some scripts that will run the first time a new user logs into a domain computer but I am not having any luck doing so. Bascially what I am trying to do is configure a homepage for IE and set some Office 2010 settings by running some scripts when a new user logs in to their machine.

I have tried creating a new key  "hkey_users\.DEFAULT\Software\Microsoft\Windows\CurrentVersion\RunOnce", adding a new string value called "First Run" and pointed it to the script which I stored for testing purposes in C:\test.

After creating the new key entry I log in as a new domain user and find that the script didn't run, or else it encountered an error. However, I am able to run the script with success if I double click it from within the new user account profile.  

here is an example of the script called "set_homepage.vbs"

Dim ChangeReg
Set ChangeReg = CreateObject("WScript.Shell")
ChangeReg.regwrite "HKCU\Software\Microsoft\Internet Explorer\Main\Start Page", "http://www.google.com/", "REG_SZ"


Am I doing something wrong? Are there any other ways to create one time login scripts for the default profile without having to use Group Policy and or running scripts from the DC?

Thanks in advance
0
Comment
Question by:cameron213
9 Comments
 
LVL 20

Expert Comment

by:Lazarus
ID: 35436981
I think on eissue is tha tyou need to do it this way: http://support.microsoft.com/kb/284193
It sounds like you added an extra step into it, rather than just pointing it directly to the script.
0
 

Author Comment

by:cameron213
ID: 35436999
That actually wont work for Windows 7 as far as I know. The Default profile is already loaded.
0
 
LVL 20

Expert Comment

by:Lazarus
ID: 35437059
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Author Comment

by:cameron213
ID: 35437243
I've actually already read both of these articles. What I have is an image that I've created with sysprep. However, there are many settings that are not transfered over during the copyprofile process. I thought I could do this using a login script that runs under the default profile, but I havent found one documented way of doing so using a Windows 7 machine.
0
 
LVL 7

Expert Comment

by:Martin81
ID: 35437465
You could create the customisations you want on a profile, then copy that up to the netlogon folder and call it 'default user.v2' That will then become your default profile for all the windows 7 and vista machines on your domain.

This explains how to do it http://support.microsoft.com/kb/973289 about half way down the page there's a section called 'How to turn the default user profile into a network default user profile in Windows 7'
0
 
LVL 20

Expert Comment

by:Lazarus
ID: 35437654
The Image information would have been useful. Martin81's link will do the trick for you.
0
 

Author Comment

by:cameron213
ID: 35441442
Like I mentioned in my question, I do not want this running from the DC. I have a mixted network of Windows XP machines and Windows 7. We are currently rolling out Windows 7. There should be a way to incorporate a script into the default user profile that will run the commands I need. Its only a few commands...one that sets the IE homepage and a few that set Office 2010 settings.

I've already created a customized OS via sysprep that has a default profile. However, some settings are not retained and this is why I need to run a script.
0
 
LVL 20

Expert Comment

by:Lazarus
ID: 35442201
When you say that the settings are not retained, do you want them permanent? If so you should be using Group Policy's. You can have your XP and Win 7 in different groups easy enough.

Or is it that you just want a Starter Settings that your users can change afterwards?
0
 
LVL 22

Accepted Solution

by:
Ivano Viola earned 2000 total points
ID: 35442343
The way I run my one-time-script is by placing a launch.cmd file in the startup folder of the configured profile which will become the default profile. When a user logs into the computer for the first time, Launch.cmd will run. The last line of code in my script will delete Launch.cmd from the startup folder of the currently logged in user.
This is the code in my Launch.cmd file:
 
wscript.exe "C:\Windows\System32\sysprep\Cleanup\Invisible.vbs" "C:\Windows\System32\sysprep\Cleanup\Config.cmd"

Open in new window

Invisible.vbs will run the bat file silently. Here is the code in my invisible.vbs file:
 
CreateObject("Wscript.Shell").Run """" & WScript.Arguments(0) & """", 0, False

Open in new window

I use config.cmd to delete unwanted folders, favorites and configure the taskbar. You can put a line in this file that calls your set_homepage.vbs. This could be your config.cmd:
 
@ ECHO OFF

:: Set Home Page
call C:\Windows\System32\sysprep\Cleanup\set_homepage.vbs > NUL

:: Deleting Launch.cmd 
del "%APPDATA%\Microsoft\Windows\Start Menu\Programs\Startup\Launch.cmd" > NUL

Open in new window


I use "C:\Windows\System32\Sysprep\Cleanup\" as the location to store the files that run.
Hopefully this helps and works for you.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today, still in the boom of Apple, PC's and products, nearly 50% of the computer users use Windows as graphical operating systems. If you are among those users who love windows, but are grappling to keep the system's hard drive optimized, then you s…
If you get continual lockouts after changing your Active Directory password, there are several possible reasons.  Two of the most common are using other devices to access your email and stored passwords in the credential manager of windows.
In this Micro Tutorial viewers will learn how to use Boot Corrector from Paragon Rescue Kit Free to identify and fix the boot problems of Windows 7/8/2012R2 etc. As an example is used Windows 2012R2 which lost its active partition flag (often happen…
This Micro Tutorial will give you a introduction in two parts how to utilize Windows Live Movie Maker to its maximum editing capability. This will be demonstrated using Windows Live Movie Maker on Windows 7 operating system.
Suggested Courses

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question