PDA

View Full Version : Login Scripts



sycogrim08
07-08-2009, 11:04 AM
Hi All

I wanted to know what script i could use to add on to my login script that changes the users background image to one that I supply from the server so that everytime they logon they get the same image i want to use even if they change it back.

Thanks ;)

graviti
07-08-2009, 11:17 AM
Use this for ideas

http://www.microsoft.com/technet/scriptcenter/resources/qanda/jan07/hey0118.mspx

wishblade
07-08-2009, 11:20 AM
If I'm not mistaken, there a registry setting that you can use - something along the lines of:
HKCU\Control Panel\Desktop
and there's a key named Wallpaper with a string value of the location of the wallpaper.

sycogrim08
07-08-2009, 11:23 AM
If I'm not mistaken, there a registry setting that you can use - something along the lines of:
HKCU\Control Panel\Desktop
and there's a key named Wallpaper with a string value of the location of the wallpaper.

Yeh i know that much however im running this script from the domain controller itself....

graviti
07-08-2009, 11:36 AM
See the link to Scripting Guy. It's something you can add to your logon script, or create a separate vbs script, and call it from your logon script, depending on your existing one.

sycogrim08
07-08-2009, 11:57 AM
See the link to Scripting Guy. It's something you can add to your logon script, or create a separate vbs script, and call it from your logon script, depending on your existing one.

Yeh thing is do i put it at the top of the login script or do i add specific things and i notice it changes registry keys isnt that dangerous though??? sorry i dont really know much about writing VB and all that... i just wanna be cautious :p

graviti
07-08-2009, 12:05 PM
What format is your original script in. .vbs form, or .bat form. If it is .vbs, then you should be able to edit it with something like this.



Const HKEY_CURRENT_USER = &H80000001

strComputer = "."

Set objReg = GetObject("winmgmts:\\" & strComputer & "\root\default:StdRegProv")

strValue = "C:\WINDOWS\System32\mywallpapername.bmp"


strKeyPath = "Control Panel\Desktop"
ValueName = "Wallpaper"

objReg.SetStringValue HKEY_USERS, strKeyPath, ValueName, strValue


It is merely setting a registry key. No real stresses, as it is changing the users value, not the machine value, so if it breaks the user, delete user and recreate. But it won't break it. You can add this at the beginning or the end of the file. Not a problem. I would recommend the end. If you like, send me you original vbscript file, and I'll clean it up for you

sycogrim08
07-08-2009, 12:21 PM
What format is your original script in. .vbs form, or .bat form. If it is .vbs, then you should be able to edit it with something like this.



Const HKEY_CURRENT_USER = &H80000001

strComputer = "."

Set objReg = GetObject("winmgmts:\\" & strComputer & "\root\default:StdRegProv")

strValue = "C:\WINDOWS\System32\mywallpapername.bmp"


strKeyPath = "Control Panel\Desktop"
ValueName = "Wallpaper"

objReg.SetStringValue HKEY_USERS, strKeyPath, ValueName, strValue


It is merely setting a registry key. No real stresses, as it is changing the users value, not the machine value, so if it breaks the user, delete user and recreate. But it won't break it. You can add this at the beginning or the end of the file. Not a problem. I would recommend the end. If you like, send me you original vbscript file, and I'll clean it up for you

Well the thing is with this string the file is supposed to be based on the actual users machine however the picture i have is on my server and thats where i need it to stay :)

wishblade
07-08-2009, 12:37 PM
Either way, whether the file is remote or local, the OS will cache the image and save a copy of it, usually within the hidden application data folder of the user (under Documents and Settings on WinXP) somewhere... so it's going to end up some way or another on the user's machine... might as well put it there somewhere and reference it :)

thisgeek
07-08-2009, 02:23 PM
Why script?

Use Group Policy and lock it down.

werner
07-08-2009, 04:45 PM
we use group policy to do this effectively

Conradl
09-08-2009, 11:36 AM
Yeah rather use GPO as mentioned above. Logon scripts are sooooo 90s :)

Smooth Criminal
09-08-2009, 11:53 AM
What format is your original script in. .vbs form, or .bat form. If it is .vbs, then you should be able to edit it with something like this.



Const HKEY_CURRENT_USER = &H80000001

strComputer = "."

Set objReg = GetObject("winmgmts:\\" & strComputer & "\root\default:StdRegProv")

strValue = "C:\WINDOWS\System32\mywallpapername.bmp"


strKeyPath = "Control Panel\Desktop"
ValueName = "Wallpaper"

objReg.SetStringValue HKEY_USERS, strKeyPath, ValueName, strValue


It is merely setting a registry key. No real stresses, as it is changing the users value, not the machine value, so if it breaks the user, delete user and recreate. But it won't break it. You can add this at the beginning or the end of the file. Not a problem. I would recommend the end. If you like, send me you original vbscript file, and I'll clean it up for you
Well the thing is with this string the file is supposed to be based on the actual users machine however the picture i have is on my server and thats where i need it to stay :)
Rather use GPO as suggested above. If that's not an option then set the path to \\<server name>\<share name>\wallpaper in the script.