I am automating the deployment of my web application on Windows 2008 server R2 using Puppet.
There are several steps in which I would be accessing the System folder (System32 or SysWOW64 depending on 32/64 bit OS).
Let me take one of these steps: I would access 'appcmd.exe' to Start/Stop website. When the script is running on 32-bit machine, I need to access the file at 'C:/Windows/System32/inetsrv/appcmd.exe'
and when the script is running on a 64-bit machine, I need to access the file at 'C:/Windows/SysWOW64/inetsrv/appcmd.exe'
Here is the part of the script that I have written. I do not want to hard-code the path. Depending the OS, i want the path to 'appcmd.exe' to be chosen. How can I achieve this?
exec {"StopWebsite":
command=> 'C:/Windows/System32/inetsrv/appcmd.exe stop site /site.name:"Default Web Site"'
}