1

他の 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 インライン スクリプトを実行する際の推奨事項はありますか?

ありがとう。

4

1 に答える 1

1

このpowershell puppetモジュールを使用して支援できます

http://forge.puppetlabs.com/joshcooper/powershell/0.0.2

この作品はより良い

于 2013-02-07T14:41:53.120 に答える