Skript-Block powershell-remote-MSI-Installation
Hallo, ich war versucht, zum ausführen MSI-Datei aus build-Maschine Ein(cttfs) und installieren Sie das MSI-Datei auf Maschine B(c2devint); output ist die website auf Maschine B.
Bitte helfen Sie mir, die Festsetzung der powershell-script, das auf Maschine A mit dem MSI-installer.Dieses Skript wird von der Maschine Ein
$cred = Get-Credential username
$session = new-PSSession -name c2devint -credential $cred
Invoke-Command -ScriptBlock {Invoke-Command -Session $session -ScriptBlock {Start-Process "msiexec.exe" -ArgumentList "/i C:\DailyBuild\DirectMSI.msi INSTALLLOCATION=D:\Websites\DirectDevInt ENVPROPERTY=DEV /qb" -Wait} -ComputerName c2devint}
Remove-PSSession $session
Hier ist der Fehler
Invoke-Command : Parameter set cannot be resolved using the specified named parameters.
At line:3 char:44
+ Invoke-Command -ScriptBlock {Invoke-Command <<<< -Session $session -ScriptBlock {Start-Process "msiexec.exe" -ArgumentList "/i C:\DailyBuild\DirectMSI.msi INSTALLLOCATION=D:\Websites\DirectDevInt ENVPROPERTY=DEV /qb" -Wait} -ComputerName c2devint}
+ CategoryInfo : InvalidArgument: (:) [Invoke-Command], ParameterBindingException
+ FullyQualifiedErrorId : AmbiguousParameterSet,Microsoft.PowerShell.Commands.InvokeCommandCommand
Und auch bitte helft mir, wie pass username & pwd zu diesem Skript
Du musst angemeldet sein, um einen Kommentar abzugeben.
Da Sie eine PSSession erstellt, verwenden Sie die
-ComputerName
parameter aufNew-PSSession
.Bewegen Sie den
-Session
parameter aufInvoke-Command
außerhalb der scriptblock:Dann entfernen
-ComputerName
paremeter aufInvoke-Command
da Sie über dieSession
paremeter einstellen.