他の msi パッケージと powershell スクリプトをインストールするために、パペット レシピ内にいくつかの powershell インライン コマンドレットを設定しようとしています。
class ps{
#http://docs.puppetlabs.com/windows/running.html
exec {'executionpolicy':
path => 'C:\Windows\sysnative\WindowsPowerShell\v1.0',
command => 'Powershell.exe "Set-ExecutionPolicy Unrestricted -Force -Verbose"',
logoutput => true
}
exec {'psremoting':
path => 'C:\Windows\sysnative\WindowsPowerShell\v1.0',
command => 'Powershell.exe "Enable-PSRemoting -Force -Verbose"',
logoutput => true,
require => Exec["executionpolicy"]
}
exec {'psmemory':
path => 'C:\Windows\sysnative\WindowsPowerShell\v1.0',
command => 'Powershell.exe "Set-Item WSMan:\localhost\Shell\MaxMemoryPerShellMB 2048"',
logoutput => true,
require => [Exec["psremoting"],Exec["executionpolicy"]]
}
}
さまざまなエラーが発生しており、アプローチを変更して、それらのインライン コマンドレットを .ps1 スクリプトに追加することを考えていました。パペット レシピとして PowerShell インライン スクリプトを実行する際の推奨事項はありますか?
ありがとう。