2

Team City と Powershell インライン スクリプトを使用して、Puppet Client for Windows をリモートでインストールしようとしています。

Invoke-command –computername %Machine Host Name% –ScriptBlock {Param($options) Start-Process -FilePath "msiexec.exe $options" -ArgumentList "/i C:\Temp\puppet-3.0.0.msi PUPPET_MASTER_SERVER=%Puppet Master Server% /l*v C:\Temp\puppet-3.0.0.log /qn" -Wait –Passthru}

ローカルマシンから実行すると問題なく動作しますが、TeamCity には引用符の処理に問題があるようです。

**[Step 2/2] Invoke-Command : A positional parameter cannot be found that accepts argument '
[09:08:08][Step 2/2] –ScriptBlock'.
[09:08:08][Step 2/2] At line:1 char:15
[09:08:08][Step 2/2] + Invoke-command <<<<  –computername vavp-pmo-agt08 –ScriptBlock {Param($option
[09:08:08][Step 2/2] s) Start-Process -FilePath msiexec.exe $options -ArgumentList /i C:\Temp\puppet
[09:08:08][Step 2/2] -3.0.0.msi PUPPET_MASTER_SERVER=vavt-pmo-sbx23.company.com /l*v C:\Temp\puppet
[09:08:08][Step 2/2] -3.0.0.log /qn -Wait –Passthru}
[09:08:08][Step 2/2]     + CategoryInfo          : InvalidArgument: (:) [Invoke-Command], Parameter 
[09:08:08][Step 2/2]    BindingException
[09:08:08][Step 2/2]     + FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell 
[09:08:08][Step 2/2]    .Commands.InvokeCommandCommand
[09:08:08][Step 2/2]  
[09:08:08][Step 2/2] Process exited with code 1**

スクリプト実行モード スイッチもうまくいきません。

4

3 に答える 3

1

PowerShellでwmiアプローチを使用してみましたか?

 $localcommand="\\$TargetServer"+"\root\cimv2:Win32_Product"

 $msi = [wmiclass]"$localcommand"
 $result=$msi.Install('Path to yourmsi\Yourmsi-1.0.0.msi', "quiet=true", $true)

私のために働きます(チームシティでも)。

于 2012-11-06T15:07:41.123 に答える
1
Invoke-command -computername %puppet.client.host% -ScriptBlock {Param($options) Start-Process -Wait -Passthru -FilePath "msiexec.exe $options" -ArgumentList "/i C:\Temp\puppet-3.0.0.msi PUPPET_MASTER_SERVER=%env.puppet.master% /l*v C:\Temp\puppet-3.0.0.log /qn"}
于 2012-11-09T18:49:46.513 に答える
1

これは私が GPO 経由で行った方法です。

Windows 上のパペット:

msi を変更して Puppet サーバー パラメータを含め、GPO 経由で配布できるようにします。

1 download puppet gpl client for windows, which is a msi file 2 install Orca from MS , it is ...
2 install Orca from MS , it is free
3 whith Orca, edit the Msi
4. go to the Property categ, you will see there the Puppet server value
5. edit and save
6. create the gpo to distribute it. Remember that computer soft installs on reboot.
于 2012-11-21T10:23:00.873 に答える