Reputation: 1303
I am trying to install Puppet Client for Windows remotely using Team City and a Powershell Inline Script.
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}
When i executed from my local machine it works just fine but it seems that TeamCity has some issues dealing with the quotes.
**[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**
No luck with the Script Execution Mode Switch as well.
Upvotes: 2
Views: 2345
Reputation: 2580
this is the way I did it via GPO.
Puppet on Windows:
modify msi to include the Puppet server param so you can distribute it through 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.
Upvotes: 1
Reputation: 1303
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"}
Upvotes: 1
Reputation: 6681
Gave you tried using the wmi approach in powershell?
$localcommand="\\$TargetServer"+"\root\cimv2:Win32_Product"
$msi = [wmiclass]"$localcommand"
$result=$msi.Install('Path to yourmsi\Yourmsi-1.0.0.msi', "quiet=true", $true)
Works for me (in teamcity too).
Upvotes: 1