DEV Community


windows cmd commands via puppet

Vadim Sohin , DevOps Engineer
・1 min read

Hey everyone, i need to run cmd commands in windows
i can achive it with exec blocks , but prefer to run it only once
pls see below the code example,
what is the best way like function or with file block ?
Thanks in advance!

class disable_updates_available::windows (
) {

exec { 'enter system32 directory':
command => "C:\Windows\System32\cmd.exe => cd /d '%Windir%\System32",

exec { 'execute takeownership of musnotification.exe':
command => "C:\Windows\System32\cmd.exe => takeown /f musnotification.exe",

Discussion (0)