Jump to content

Recommended Posts

Posted (edited)

Hi,

 

I have an annoying issue with GP where I am setting the desktop wallpaper in GP (User Configuration>Policies>Administrative Templates>Desktop>Desktop>Desktop Wallpaper) this is set to a shared UNC path (\\server\netlogon\wallpaper\wallpaper.jpg).

 

So If I create a user "test" this new user will get my new Desktop wallpaper. which is fine. The problem comes if I change this wallpaper to a different image, but maintaining the file name and replacing the image in the shared store. My user "test" wont have updated to the new wallpaper, however if I make another new user "test1" this new user will have the updated wallpaper.

 

To me this is some kind of "caching" issue? where the wallpaper is being cached somehow? its puzzling the heck out of me.

 

I work in a school environment so to have a desktop that can change with local events or seasons would be a nice touch.

 

Server 2019desktops are all Windows 10

 

Many Thanks

 

Delleropk

Edited by Delleropk
Posted (edited)

I had this problem as well here. Was able to sort it by using this powershell login script

 

$user = $Env:USERNAME # Get's curent username
$path1 = "c:\Users" # First part of path
$path2 = "\AppData\Roaming\Microsoft\Windows\Themes" # Second part of path
$fullpath = $path1 + $user + $path2 # Create full path
$file2 = "TranscodedWallpaper"
Get-ChildItem $fullpath -Include $file2 -Recurse | Remove-Item # Actual Delete

 

The issue lays with the TranscodedWallpaper file stuck in the users windows themes. This for some reason does not up date when the new desktop image is published to the shared location in the GPO.

Edited by subway_lunch
Tidyiing up code section for script
  • Thanks 1
Posted (edited)
I had this problem as well here. Was able to sort it by using this powershell login script

 

$user = $Env:USERNAME # Get's curent username
$path1 = "c:\Users" # First part of path
$path2 = "\AppData\Roaming\Microsoft\Windows\Themes" # Second part of path
$fullpath = $path1 + $user + $path2 # Create full path
$file2 = "TranscodedWallpaper"
Get-ChildItem $fullpath -Include $file2 -Recurse | Remove-Item # Actual Delete

 

The issue lays with the TranscodedWallpaper file stuck in the users windows themes. This for some reason does not up date when the new desktop image is published to the shared location in the GPO.

 

 

*UPDATE*

 

This SO nearly works, just not quite, I'm wondering if you can help me tweak it. The first thing I realised was that we use roaming Profiles stored on the server so I had to change "C:" to the UNC path.

 

If I manually navigate to this location for a particular user and delete the transcodedwallpaper myself and then logon with that user, it works! YAY! but I cant seem to get this script to do it on log in. I've been applying this script in the following location in the GPM:

 

User Configuration>Policies>Windows Settings>Scripts>Logon

 

 

this is the script I've been using

 

$user = $Env:USERNAME # Get's curent username
$path1 = "\\server\profiles$\Students\" # First part of path
$path2 = "\AppData\Roaming\Microsoft\Windows\Themes" # Second part of path
$fullpath = $path1 + $user + $path2 # Create full path
$file2 = "TranscodedWallpaper"
Get-ChildItem $fullpath -Include $file2 -Recurse | Remove-Item # Actual Delete

 

any ideas? I've been fiddling with this all day....

 

Many Thanks

 

Delleropk

Edited by Delleropk
spelling error
Posted

Just looked at my version for my citrix environment, and have done it slightly different to that.

 

Where you have

$path1 = "\\server\profiles$\student"

 

try by doing it this way

 

$path1 = "\\servername\driveleter\foldersharename\Students"

[\quote]

 

so it would be something like

 

$path1 = "\\myfileserver\f$\userdata\Students"

 

Give that a try and see what happens.

 

The reason I am saying do it this way, is because the logon script might be actually running before your profile redirection script and share mappings gpo is being applied.

  • Thanks 1
Posted (edited)

Even if you are using roaming profiles you should still delete the cached wallpaper from the c drive as the profile isn't written back to the server until logoff. As well as the transcodedwallpaper file you need to empty the cachedfiles folder. This is the vbs logoff script I wrote to do this job, I found logoff works better as it means there is never a cached wallpaper at point of logon meaning the new one will always be picked up. Good luck!

 

On Error Resume Next
strPath = CreateObject("WScript.Shell").ExpandEnvironmentStrings("%APPDATA%") & "\Microsoft\Windows\Themes"
Set obj = CreateObject("Scripting.FileSystemObject") 
obj.DeleteFile(strPath & "\TranscodedWallpaper")
obj.DeleteFile(strPath & "\CachedFiles\*.*")

Edited by smarties11
  • Thanks 1
Posted (edited)
Even if you are using roaming profiles you should still delete the cached wallpaper from the c drive as the profile isn't written back to the server until logoff. As well as the transcodedwallpaper file you need to empty the cachedfiles folder. This is the vbs logoff script I wrote to do this job, I found logoff works better as it means there is never a cached wallpaper at point of logon meaning the new one will always be picked up. Good luck!

 

On Error Resume Next
strPath = CreateObject("WScript.Shell").ExpandEnvironmentStrings("%APPDATA%") & "\Microsoft\Windows\Themes"
Set obj = CreateObject("Scripting.FileSystemObject") 
obj.DeleteFile(strPath & "\TranscodedWallpaper")
obj.DeleteFile(strPath & "\CachedFiles\*.*")

 

***FIXED!!!***

 

Thanks to all that helped along the way, Thank you @subway_lunch for all of your help, sorry I couldn't get your method to work!

 

 

Just to clarify to any others trying to do this fix, I used the code above and made it into a VBS script. then added that script into the logoff policy in GPM and then linked that to the relevant users. for the first time to see If this worked I had to Log on, log off and then log on again to see the updated wallpaper

 

AJWhite1970

Would using BGInfo.exe be a better bet as all you would need to do is call it from the login script and edit and maintain one .bgi file..?

 

Having said all that I would be interested in this method for future development, I've heard about this but not really looked into it before, is there a help sheet or guide that you recommend to get started with learning about this?

 

Thanks again all.

 

Delleropk

Edited by Delleropk
added further clarification
Posted

BGInfo is one of the Microsoft SysInternal programs which can be found here:- https://docs.microsoft.com/en-us/sysinternals/downloads/bginfo

 

Useful for setting wallpaper, putting info on screen etc, the screen shots in the link above should give you a starting point.

 

Called by running "\\path\to\Bginfo.exe \\path\to\config_file.bgi /SILENT /NOLICPROMPT /TIMER:0"

 

You can have the .exe local or on a server and can have several different config files, one for each client type (or staff, student, admin)

 

My screen output looks like this and sits in the bottom right of every desktop, the blue wallpaper is also set by bginfo:-

 

bginfo.JPG

 

HTH

Andrew

  • Thanks 1
Posted
***FIXED!!!***

 

Thanks to all that helped along the way, Thank you @subway_lunch for all of your help, sorry I couldn't get your method to work!

 

 

Just to clarify to any others trying to do this fix, I used the code above and made it into a VBS script. then added that script into the logoff policy in GPM and then linked that to the relevant users. for the first time to see If this worked I had to Log on, log off and then log on again to see the updated wallpaper

 

 

 

Having said all that I would be interested in this method for future development, I've heard about this but not really looked into it before, is there a help sheet or guide that you recommend to get started with learning about this?

 

Thanks again all.

 

Delleropk

 

Ah that's great, pleased my vbs worked for you! I used to use GPP to delete the files but then I found that when a user is logged in, and a background policy refresh occurs, the user ends up with no wallpaper. So a logoff script is definitely the best place for it.

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



×
×
  • Create New...