2012-11-06 1 views
1

Team City 및 Powershell Inline Script를 사용하여 Windows 용 Puppet Client를 원격으로 설치하려고합니다.MsiExec 및 Powershell을 사용하여 원격으로 Windows 용 Puppet 설치

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** 

스크립트 실행 모드 스위치에도 문제가 없습니다.

답변

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) 

나를 위해 일합니다 (팀도 마찬가지).

+0

이 일이 내 일을 구했습니다. Invoke-command -computername % puppet.client.host % -ScriptBlock {Param ($ options) 시작 프로세스 -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 "} – Maverick

0
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"} 
1

이것은 GPO를 통해 수행 한 방법입니다. Windows에서

인형 : 당신이 GPO를 통해 배포 할 수 있도록

는 꼭두각시 서버 PARAM을 포함하는 MSI 수정은 :

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. 
관련 문제