Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Exec Resource with Reg Query Fails

Hi,

I am having some problems trying to get the unless attribute to work with the following reg.exe query to check if framework 4.5 is installed and not to execute the installer again.

 Exec  { path => [ "C:\\Windows\\sysnative\\WindowsPowerShell\\v1.0\\","C:\\Windows\\sysnative\\","C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319\\","C:\\Windows\\System32\\wbem\\" ] } 

  exec { 'netframework45':
    command   => 'powershell.exe write-host "hello"',
    logoutput => true,
    timeout   => 900,
    unless    => 'cmd /c "C:\Windows\System32\reg.exe query \"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full\"| findstr.exe 4.5.50709"',
  }