Hello everybody,
I have the following problem.
I need to run a batchfile on Server 1 with a powershell command on Server 2.
When I run the batchfile manually (doubleclick) on Server 1, the batchfile is being executed well and does its deployment job.
Unfortunately when running the batchfile from Server 2 via a powershell command, it seems to work but then only shows me “echo off” (see below) and does not execute the rest of the batchfile.
Powershell Script on "Server2":
[pre]$Username = 'USERNAME' $Password = 'PASSWORD' $pass = ConvertTo-SecureString -AsPlainText $Password -Force $Cred = New-Object System.Management.Automation.PSCredential -ArgumentList $Username,$passtry
{
Invoke-Command -ComputerName “Server1” -ScriptBlock {cmd /c “L:\Test_Deploy.bat”} -Credential $Cred -ErrorAction Stop
}
catch {Write-Host “error”}[/pre]
L:\Test_Deploy.bat on Server1:
[pre]echo off cd /d "C:\Program Files\Microsoft SQL Server\###\DTS\Binn" ISDeploymentWizard.exe /Silent /SourcePath:"\\Server3\h$\Jenkins_workspace\SSIS\1234 Admin\Bin\Development\1234 Admin.ispac" /DestinationServer:"Server2" /DestinationPath:"/SSISDB/0 Tools/1234 B-Admin" EXIT /b 0[/pre]
Very gratefull for every kind of help.
Looking forward to hearing from you.
Best regards
Manfred