Link to home
Start Free TrialLog in
Avatar of Nirmal Sharma
Nirmal SharmaFlag for United States of America

asked on

Simple Question.

We have total of 900 computers in our network. We need to implement different-differnet wallpaper using Group Policy or a script. Example:  -

Wallpaper1 - Computer1
Wallpaper2 - Computer2
Wallpaper3 - Computer3
Wallpaper4 - Computer4
Wallpaper5 - Computer5
Wallpaper6 - Computer6
Wallpaper7 - Computer7
and so on...

Without using Roaming Profile.

Is there any script by which we can implement the above setting?

Thanks
SystmProg
Avatar of JamesDS
JamesDS

SystmProg
Wallpaper is user specific, so this has to be done in the User context - that means no startup script.

GPOs can't accept variables and each wallpaper has a different name - unless you choose to store it on the local machine and NOT a central server location.

I think I would choose to do it with a logon script and store the wallpapers centrally.

You know the registry keys to change and you will already have a copy of RegWrite or the ability to do it with VBScript. You will need to allow users to alter that key, so you'll also need a system policy to assign them the necessary rights - unless of course you can push the settings out with a custom MSI.

A few ideas for you, which way are you thinking of going??

Cheers

JamesDS
Avatar of Nirmal Sharma

ASKER

James,

You are correct. Wallpaper is user specific but its not so easy as you think. It requires a sort of programming or script which will run through the Login Script. I really want different wallpapers on each machine. If i create MSI that will deploy the same wallpaper on all machines.

>>>You know the registry keys to change and you will already have a copy of RegWrite or the ability to do it with VBScript. You will need to allow users to alter that key, so you'll also need a system policy to assign them the necessary rights - unless

I really don't have that much expertise. I don't have RegWrite or ability to do with VBScript. Please provide a link for RegWrite. One more thing i want to tell you...when users logs on the HKEY_CURRENT_USER from NTuser.dat is loaded first and then group policy settings are applied so i think we don't need to assign them necessary rights as they are writing to their own registry key. By default they are owner of this key, and it runs under the security context of User account only. If i run it as a login script then that should do the job but again it requires a sort of programming.

Programming in the sense: -

User logs on,

A loop should start here:  -

ncount=1

CopyWallpaper=\\Server\Wallpaper\Wal+ncount.jpg  >>>>>>>>>>>A System variable created.

copy wal1+ncount.jpg C:\winnt\system32\wal1+ncound.jpg

the script will check the wallpaper in \winnt\system32\Wallpaper\Wal1.jpb
if the Wal1.jpg already exists in the destination computer then ncount will be incremented by 1 and will loop and will copy
the next wallpaper and then again will check whether it is exists or not.

ncount=ncount+1
loop

Endloop

As far i know a script must be created using the above sample or if you know better than this. I am basically a Foxpro and C++ programmer. So i don't know DOS, Batch or VBScript programming.

Thanks
SystmProg
James,

One more thing i want to know......Is it possible to point a Wallpaper to a central location or the wallaper must be present in the user computer?
SystmProg

The MSI could deploy a regkey that was set to look for wallpaper called "\\server\share\%machinename%.bmp"

RegWrite is actually REG_X86.EXE and came with the NT4 resource kit: ftp://ftp.microsoft.com/bussys/winnt/winnt-public/reskit/nt40/i386/reg_x86.exe

I would go with naming the wallpaper for the machinename if I were you, much easier than generating your own index.

This code will set the wallpaper:

HKEY_CURRENT_USER = &H80000001
strComputer = "."
Set objReg = GetObject("winmgmts:\\" & strComputer & "\root\default:StdRegProv")
strKeyPath = "Control Panel\Desktop"
objReg.CreateKey HKEY_CURRENT_USER, strKeyPath
ValueName = "Wallpaper"
strValue = "c:\windows\wallpaper.jpg"
objReg.SetStringValue HKEY_CURRENT_USER, strKeyPath, ValueName, strValue


This code gets the computer host name:

Dim objWSHNetwork
Dim strComputerAccountName

Set objWSHNetwork = CreateObject("WScript.Network")
strComputerAccountName = objWSHNetwork.ComputerName
wscript.echo strComputerAccountName

How are we doing so far?

Cheers

JamesDS
Avatar of oBdA
Am I correct in assuming that you want to have information such as machine name, IP address and whatever on your machines?
Then I'd recommend using Sysinternal's BgInfo; you can start it from the logon script, and it will generate a background image with the system information you pick: http://www.sysinternals.com/ntw2k/freeware/bginfo.shtml
oBdA

Actually I use it here, I assumed SystmProg wanted to do something else!

I put the executable on each machine and put a link in the startup folder of the all users start menu. Job done!

Top tool!

Cheers

JamesDS
I wanted to do something else. I have already mentioned in my question that i want differenet-differenet wallpapers on all machines (900). This is only possible by using a script.

James,

>>>The MSI could deploy a regkey that was set to look for wallpaper called "\\server\share\%machinename%.bmp"

How will you implement this setting as MSI package itself is not aware of all wallpapers. How MSI will put different-different wallpapers using the Variable defined?

>>>I would go with naming the wallpaper for the machinename if I were you, much easier than generating your own index.

For 900 machines, its not so easy to do so.

So you want me to put the script you designed in Login Script or Startup Script?

Let me know.

Cheers
SystmProg
So the first script should rename all wallpapers located in a central folder in server: -

1. Rename all wallpapers using a script.
2. Secondly create a script which will set wallpaper to all machines one-by-one. That means wallpaper already set should not be repeated in next.

Using Script: -

1. First i need to find the wallpaper on destination machine

2. If wallpaper already exists on the destination script then programm will loop  and will search for the next wallpaper and then again find the wallpaper.....so on...

3. At last script will copy the wallpaper to destination machine with registry keys and its location.

So i really can't find a better way to do so.

What do you say James!
oBdA,

Read the question carefully and then post.

SystmProg

The question is: Do you already have all 900 wallpapers created and named 1 through 900, or similar?
If so, then I would create a CSV text file containing 2 columns - the name of the machine and that of the wallpaper.

Then you need 1 login script that opens the CSV file, finds the correct wallpaper, copies it locally, sets the reg entries and completes.

Only one script needed!

Do you need some code to open a text file and parse it??

BTW steady on with your comment to oBdA - he's only trying to help!

Cheers

JamesDS
Now one more thing.....pointing script to HKEY_CURRENT_USER\Control Panel\Desktop will not do the job i think so far because i have already applied to Group Policies to user and computers and can't remove it.

1. First script will run for HKEY_CURRENT_USER\Control Panel\Desktop. (User Profile).
2. And then Administrative Templates will be applied from User Configuration after login script runs. So ultimate result is no wallpaper because User Profile settings will be overwritten by User Configuration policy. The Group Policy stores its information for wallpaper in any one of the following: -

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System\
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System\

Am i wrong or right ? Please let me know.

A wallpaper should be present in a machine or we can point to a server location.

Thanks
SystmProg
>>>The question is: Do you already have all 900 wallpapers created and named 1 through 900, or similar?

I already have more than 900 wallpapers and not similar. You can't keep the same name file in a directory :-)

>>>If so, then I would create a CSV text file containing 2 columns - the name of the machine and that of the wallpaper.

Please be clear here....are you talking about creating a Comma de-limited file such as:  -

Wallpaper1               Machinename1
Wallpaper2               Machinename2
Wallpaper3               Machinename3

>>>Then you need 1 login script that opens the CSV file, finds the correct wallpaper, copies it locally, sets the reg entries and completes.

>>>Do you need some code to open a text file and parse it??

That's exactly i want.

>>>BTW steady on with your comment to oBdA - he's only trying to help!

James,

I just wanted to tell him that he is not posting in right direction.

Thanks
SystmProg
Excellent

The file should actually be the other way around and it should contain the full path for ease later. The code uses TAB as the delimiter:

MachineName1    \\servername\sharename\Wallpaper1
MachineName2    \\servername\sharename\Wallpaper2
MachineName3    \\servername\sharename\Wallpaper3
MachineName4    \\servername\sharename\Wallpaper4

'Code!:

'File Handling Stuff
const ForReading                    = 1
const ForWriting                    = 2
const ForAppending                    = 8

strSourceFile = "\\servername\sharename\Input.txt"

Set objSourceFile                    = CreateObject("Scripting.FileSystemObject")
Set objSourceFileContent            = objSourceFile.OpenTextFile (strSourceFile, ForReading)

While Not objSourceFileContent.AtEndOfStream

    strInputAll = objSourceFileContent.ReadLine()

    if left(strInputAll, 1) <> ";" Then                                                ' Do not process lines beginning with ";" as these are comments
       
        strInputAll                    = trim(strInputAll)                                ' Trim spaces off the String
       
        arrInputAll                    = split(strInputAll, vbTab)                        ' Parse out each Field into an array element
       
        strMachineName        = arrInputAll(0)
        strMachineWallpaper            = arrInputAll(1)

'stick your code to copy the wallpaper locally and set the registry entries here!

        End if
    Wend

'code ends------------

Cheers

JamesDS
That's great, James.

Will let you know shortly.

Your help is really appreciated.

Thanks
SystmProg
ASKER CERTIFIED SOLUTION
Avatar of JamesDS
JamesDS

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
That's great!!! did it but only one thing left. When i apply this policy or run this script Group Policy part overwrites the registry settings. What to do ?

Thanks
SystmProg
Why would you want to set wallpaper in the GPO AND via a script?

The GPO WILL overwrite your script based settings, so the only propoer fix is to remove the offending GPO setting from the GPO. You could use GPO filtering to exclude your 900 machines from running the GPO, but I suspect that your GPO sets other things you want to keep.

Perhaps a second GPO for machines not getting the script might be in order - you could use the GPMC to copy the settings from one GPO to another.


Cheers

JamesDS
The same i did using a second GPO.

Thanks for the help, James.

Cheers

SystmProg
SystmProg
Welcome

Cheers

JamesDS