Ask Your Question

How to manage desktop Icons(Windows) ?

asked 2015-06-09 16:45:03 -0500

karatyman gravatar image

Hey Guys. So this is a question I've been asking for some time, and have yet to find an answer that worked for me. I finally came across the solution and would like to share it with the puppet community in case anyone else wishes to manage desktop shortcuts in windows.

Needed modules: puppetlabs/powershell, puppetlabs/windesktopshortcut

While learning more about the windows Operating system I stumbled upon this Gem: 'C:/Users/Public/Desktop" This file lets you centrally manage Desktop Icons for all users on a PC! So heres how my module works

file { 'C:/Users/Public/Desktop' :

ensure => directory, source => 'C:/Puppet/Icons', recurse => 'true', purge => 'true', force => 'true', source_permissions => ignore,


exec { 'Clear Desktop': command => 'Remove-Item C:\Users\~~InSeRtUsErNaMeHeRe~~\Desktop* -force -recurse', provider => powershell, }

So what this does is deletes everything on the specified users desktop using powershell(You could do this with batch too, I am just a powershell fanboy.) Doing so deletes all the unwanted files left on the desktop by users. Once the Icons are deleted from the desktop it points to the specified source folder (I used a local directory because I currently test with Masterless puppet, but you could easily change this line to a directory on the puppet file server.) Once it finds your Icon folder, it copies all the files there and places them into the Public Desktop

I hope this can help admins trying to run puppet on Windows!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2015-06-09 16:48:18 -0500

karatyman gravatar image

For more simplified Windows Manifests check out my github page!

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2015-06-09 16:45:03 -0500

Seen: 456 times

Last updated: Jun 09 '15