Ich bin neu in Powershell und kann nicht verstehen, warum ich die folgenden FehlerÄrger mit Invoke-Command mit Script und -ArgumentList
Invoke-Command erhalten: Ein Positionsparameter gefunden werden kann dieses Argument nicht akzeptiert ‚D : \ Deploy \ Datei.zip '. Bei D: \ source \ Scripts \ Errichten-Deploy \ Errichten-Deploy \ ServersDeploy.ps1: 105 Zeichen: 5
- Invoke-Command -ComputerName $ Server -ScriptBlock {
- ~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- CategoryInfo: InvalidArgument: (:) [Invoke-Command], ParameterBindingException
- FullyQualifiedErrorId: PositionalParameterNotFound, Microsoft.PowerShell.Commands.InvokeCommandCommand
Dies ist das Skript das ausgeführt wird
params([string[[]]$servers, [string]$dest_package_path, [string]$src_package_path,[string]$deploy_script)
Invoke-Command -ComputerName $servers -ScriptBlock {
param($dest_package_path,$src_package_path,$deploy_script)
Write-Output "Destination path = $dest_package_path"
Write-Output "Copying zip $src_package_path to the destination host"
New-Item -ItemType Directory -Force -Path $dest_package_path
Write-Output "Directory Created"
Copy-Item -Path $src_package_path -Destination $dest_package_path -Force
Write-Host "Copying remote deploy scripts to the destination host"
Copy-Item -Path $deploy_script -Destination $dest_package_path -Force
} -ArgumentList $dest_package_path $src_package_path $deploy_script