0Enable windows desktop slideshow with a script

I’ve been updat­ing my unat­ten­ded win­dows deploy­ment setup recently, and one of the things I wanted to enable was the slideshow wall­pa­per with the loc­a­tion set to my wall­pa­pers loc­a­tion on my serv­er. This isn’t as straight-for­ward as it ought to be, but after bit of fid­dling around I figured out how to do it fairly simply.

2 parts are neede — a reg script and copy­ing a file (which I do via a self-extract­ing archive file).

The reg script is as follows

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Control Panel\Personalization\Desktop Slideshow]
"Interval"=dword:000927c0
"Shuffle"=dword:00000001

[HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Wallpapers]
"SlideshowSourceDirectoriesSet"=dword:00000001
"BackgroundType"=dword:00000002
"SlideshowDirectoryPath1"="/long-random-looking-string-goes-here"

Note — you will need to set up the slideshow with the cor­rect path on one of your PCs and then export the value for “SlideshowDirectoryPath1” from your registry for this to work

The second part is to copy a file called slideshow.ini (also after set­ting up your own slideshow) which lives in %appdata%\Microsoft\Windows\Themes

The con­tents of this file con­tain an encoded ref­er­ence to the loc­a­tion of your slideshow I believe.

Once you have copied the file and impor­ted the reg file you just need to restart explorer or wait for the inter­val peri­od to pass (mine is set to 10 minutes) and I have shuffle turned on — your val­ues may be dif­fer­ent if you set them dif­fer­ently and export the changed val­ues from the registry

I have put my slideshow.ini into a self-extract­ing exe that extracts to (and silently over-writes) %appdata%\Microsoft\Windows\Themes. I then run my 2 com­mands using the fol­low­ing Syn­chron­ousCom­mands in my ImageUnattend.xml

<SynchronousCommand wcm:action="add">
  <Order>6</Order>
  <Description>Set slideshow location</Description>
  <CommandLine>c:\extras\slideshow.exe</CommandLine>
</SynchronousCommand>
<SynchronousCommand wcm:action="add">
  <Order>7</Order>
  <Description>Enable slideshow</Description>
  <CommandLine>c:\extras\elevate -c reg import c:\extras\slideshow.reg</CommandLine>
</SynchronousCommand>

For more inform­a­tion about my use of the com­mand “elev­ate” and hav­ing files in the c:\extras folder please read my pre­vi­ous art­icle about how I used a “Batch script to rename PC based on reserved DHCP name

What do you think? Drop us a comment below! If you would like to subscribe please use the subscribe link on the menu at the top right. You can also share this with your friends by using the social links below. Cheers.

Leave a Reply