Hello Guys,
I 'm having problems when I want to execute a powershell Script remote from an Execute Stage or in a routine using CALL DSEXECUTE.
So, the script ist to execute Db Backups locally on the remote server and it works just fine when I run it from my CMD or PS shell.
Nevertheless, when I do the same execution in Designer does not work.
Does anybody knows I to run a powershell Script in Ds 8.7?,
is there any previous setting to do?
Thanks a lot in advance
Max
Run Powershell from Execute Stage
Moderators: chulett, rschirm, roy
Could you post how you call it up from the command line manually and how you call it from DataStage? Please also include the error message.
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
-
- Premium Member
- Posts: 42
- Joined: Wed Aug 31, 2011 2:56 am
- Location: St. Gallen - CH
- Contact:
From the command line (CMD): powershell -File Script1.ps1 (works good)
From Powershell : .\Script1.ps1 (works also good)
In DS Execute Command Stage :
- Command = powershell
- Parameters = -File <scriptpath>\script1.ps1
Error:
---------------
Backup_Test..JobControl (@Execute_Command_1): Executed: powershell -File <scriptpath>\script1.ps1
Reply=0
Output from command ====>
Invoke-Command : An internal error occurred.
At <scriptpath>\script1.ps1:6 char:15
+ invoke-command <<<< -computerName <server1> -Credential $Cred -ScriptBlock {
& '<ServerScriptPath>\script2.ps1' par1 par2 par3}
+ CategoryInfo : InvalidOperation: (:) [Invoke-Command], PSInvali
dOperationException
+ FullyQualifiedErrorId : InvalidOperation,Microsoft.PowerShell.Commands.I
nvokeCommandCommand
-------------------------
Can it be credentials problems ?
Even if I want to execute a normal (powershell get-help) also does not work.
Any idea?
Thanks a lot in advance
From Powershell : .\Script1.ps1 (works also good)
In DS Execute Command Stage :
- Command = powershell
- Parameters = -File <scriptpath>\script1.ps1
Error:
---------------
Backup_Test..JobControl (@Execute_Command_1): Executed: powershell -File <scriptpath>\script1.ps1
Reply=0
Output from command ====>
Invoke-Command : An internal error occurred.
At <scriptpath>\script1.ps1:6 char:15
+ invoke-command <<<< -computerName <server1> -Credential $Cred -ScriptBlock {
& '<ServerScriptPath>\script2.ps1' par1 par2 par3}
+ CategoryInfo : InvalidOperation: (:) [Invoke-Command], PSInvali
dOperationException
+ FullyQualifiedErrorId : InvalidOperation,Microsoft.PowerShell.Commands.I
nvokeCommandCommand
-------------------------
Can it be credentials problems ?
Even if I want to execute a normal (powershell get-help) also does not work.
Any idea?
Thanks a lot in advance
MGS
-
- Premium Member
- Posts: 42
- Joined: Wed Aug 31, 2011 2:56 am
- Location: St. Gallen - CH
- Contact:
Thanks for the reply, but I dont understant to whom you call animal.chulett wrote:Note that this is not the Execute Command stage but rather the Execute stage which is unique to a Windows server install. Not the same animal.
Anyway, Yes, I have Server Edition in a Windows System installed and I see the name of the Stage is Execute Command
MGS
I removed my post after you answered with your details as I was obviously wrong. I was basing my assumption on the wording in your initial post and the fact that you were on Windows, never mind that it is very early in the morning for me. There is an actual stage named the Command Stage which only comes with Windows and which tends to confuse people. Case in point, me.
And all I meant by they are "not the same animal" is that the two stages are different.
And all I meant by they are "not the same animal" is that the two stages are different.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
Looks like that may be the case. Check the last post in this thread and see if that helps.mgsteiner wrote:Can it be credentials problems ?
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
I see you are using a relative path to the command file. The working directory for DataStage commands is set to the project directory, so perhaps it is a path issue. You can copy "script.ps1" to the project directory to test that.
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>