Ask Your Question

How do I write a module with Puppet for windows .lnk shortcuts

asked 2013-01-31 15:33:37 -0600

tracyfan_1 gravatar image

I am using puppet to manage a few windows hosts on a very small network just to get it going and really understand it and would like to know how I can edit the target field in a .lnk shortcut file to point to a new target with certain parameters?

I know where the shortcut files are I am just not sure how I can edit the target fields in the .lnk shortcuts properties using a module. If anyone can help it would be much appreciated.


edit retag flag offensive close merge delete

3 Answers

Sort by ยป oldest newest most voted

answered 2013-02-13 23:20:41 -0600

stahnma gravatar image
edit flag offensive delete link more


The example in this module is somewhat of a misnomer. It does not create literal Windows shortcuts, it actually creates an Internet Explorer Favorite file, which is a simple text ...(more)

alindstrom gravatar imagealindstrom ( 2014-03-03 14:08:26 -0600 )edit

answered 2013-01-31 17:22:59 -0600

czervik gravatar image

updated 2013-01-31 17:26:33 -0600

Puppet can't natively manage windows lnk files. This may not be flexible enough for your needs, but I just bundle the needed variations of shortcuts in Puppet and use facts to load the right shortcut. For example,

  $shortcut_source = $::os_architecture ? {
   '64'  => 'shortcut64.lnk',
   '32'  => 'shortcut32.lnk',

file { 'shortcut':
  path    => 'C:/shortcut.lnk',
  ensure  => present,
  source  => "puppet:///modules/example/${shortcut_source}",

You could also write a custom type/provider that programmatically manages shortcuts. This might be a good place to start:

Not sure if there is a pending feature request to add ... (more)

edit flag offensive delete link more

answered 2013-02-07 14:39:32 -0600

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


Asked: 2013-01-31 15:33:37 -0600

Seen: 1,158 times

Last updated: Feb 13 '13