Ask Your Question
0

running script windows

asked 2016-03-25 11:04:45 -0500

robarros gravatar image

Hello I would like some help on how I can create module to run this command on windows

netsh advfirewall set allprofiles state off

Thank you

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
0

answered 2016-03-27 05:55:45 -0500

You'd create something like this:

advfirewall/manifests/init.pp:

class advfirewall {
  exec { 'set-allprofiles-state-off':
    command => 'netsh advfirewall set allprofiles state off',
    unless  => '...',
  }
}

In the 'unless' line, you would insert a command that will return true if the netsh command has already run (note you may find you need to use 'creates' or 'onlyif' here instead of 'unless'). This is for maintaining idempotence. Read the documentation for exec and also tips for exec on Windows.

Of course, if you have nothing else in a module than this command, you probably should put this in your base profile, rather than in its own module. If you don't know what I mean by profiles, google Puppet roles & profiles.

edit flag offensive delete link more
0

answered 2016-03-27 06:42:50 -0500

robarros gravatar image

alex how are you?

i create this module, but has this error in attach C:\fakepath\error.PNG

edit flag offensive delete link more

Comments

I'll need to know more than that before I could say what you've done wrong. It'll be about files not being in the correct locations on the Puppet Master.

Alex Harvey gravatar imageAlex Harvey ( 2016-03-27 06:46:10 -0500 )edit

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

Stats

Asked: 2016-03-25 11:04:45 -0500

Seen: 615 times

Last updated: Mar 27 '16