Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

login scripting.

Status
Not open for further replies.

Junior1544

Technical User
Apr 20, 2001
1,267
US
I was wondering if some one would be able to get me started in windows xp login scripting... An online tutorial would be fine to get me going and get a few more specific questions more suited for posting on here...

One this that I would like to be able to do, is change the users background on login. That doesn't have to be done in a login script, but that is one big thing I need done...

Thanks a bunch

--James

junior1544@jmjpc.net
Life is change. To deny change is to deny life.
 
Method #1: Create a .reg file.

.REG files are run in the logon script using regedit /s <reg file>

The format of the file is
Windows Registry Editor 5.0
<blank line>
<key name>
&quot;<value name>&quot;=&quot;<value>&quot; a string value
&quot;<value name>&quot;=hex:<value> a binaryvalue
&quot;<value name>&quot;=dword:<value> a dword value

for your wallpaper example:

Windows Registry Editor 5.0
[HKEY_USERS\.DEFAULT\Control Panel\Desktop]
&quot;Wallpaper&quot;=&quot;wall paper path and filename&quot;
&quot;TileWallpaper&quot;=&quot;0&quot;

Method #2: Use .inf files.

The second method is to user a Windows 95 style .inf file. These are run using the command
rundll32 syssetup,SetupInfObjectInstallAction DefaultInstall 128 <inf file>

The format of the file is as follows
[Version]
Signature = &quot;$Chicago$&quot;
Provider=%Provider%
[Strings]
Provider=&quot;Your name&quot;
[DefaultInstall]
AddReg = AddReg
DelReg = DelReg
UpdateInis = UpdateInis
[AddReg]
[DelReg]
[UpdateInis]
Below are the keys to be used
HKCR HKEY_CLASSES_ROOT
HKCU HKEY_CURRENT_USER
HKLM HKEY_LOCAL_MACHINE
HKU HKEY_USERS

The file below is an .inf file which performs the same as the .reg file described earlier

[Version]
Signature = &quot;$Chicago$&quot;
[DefaultInstall]
AddReg = AddReg
[AddReg]
HKU,&quot;.DEFAULT\Control Panel\Desktop&quot;,&quot;Wallpaper&quot;,0000000000,&quot;your full filename for wallpaper&quot;
HKU,&quot;.DEFAULT\Control Panel\Desktop&quot;,&quot;TileWallpaper&quot;,0000000000,&quot;1&quot;


If we named this my_background.inf, then the logon script would have the line:

rundll32 syssetup,SetupInfObjectInstallAction DefaultInstall 128 my_background.inf

Method #3: A pure Windows Scripting Host script.

This would be entered into a file my_background.vbs, and the logon script would have the line:
cscript my_background.vbs

Set WshShell = WScript.CreateObject(&quot;Wscript.Shell&quot;)
WshShell.RegWrite &quot;HKCU\Control Panel\Desktop\Wallpaper&quot;,
&quot;your full path and filename of wallpaper here&quot;
WshShell.Run _
&quot;%windir%\System32\RUNDLL32.EXE user32.dll,UpdatePerUserSystemParameters&quot;, _
1, False

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top