Este Módulo Puppet tentará executar um script PowerShell personalizado em um novo processo do PowerShell para preservar os privilégios do processo pai.
class webserverpostdeploymentscripts {
if $osfamily == 'windows' {
$wsrpsscriptfile = 'restart-website.ps1'
$powershellexe = 'C:/Windows/System32/WindowsPowerShell/v1.0/powershell.exe'
$wsrpsscriptpath = "C:/Windows/Temp/${wsrpsscriptfile}"
file { 'restart-psscript':
path => $wsrpsscriptpath,
ensure => "file",
source => "puppet:///files/$wsrpsscriptfile"
} ->
exec { 'restart-website':
command => "start-process -verb runas $powershellexe -argumentlist '-file ${wsrpsscriptpath}'",
provider => "powershell"
}
}
}