Hi,
I have a problem with my workflow for creating a template form a selected VM.
My workflow consists of a "scriptable task"(IN parameter: VM, folder, resourcepool, name, OUT parameter: output). which formats the input objects to string and paste them to an "invoke external script" with a powershell script(IN parameter: host, externalscript, arguments, OUT parameter: output).
After execution the output is given to another "scriptable task" which has no programming yet.
The problem is that the ps script does its job and after the end, it is started another time but also aborted after a few steps and I can't figure out why.
The simplified start of my ps script looks like this:
param(
$vmfo,
$name
)
$log = "\\server_ip\D$\scripts\logs\wf_tpl_log.txt"
date
date >>$log
echo "VM or Folder:$vmfo, Name:$name"
echo "VM or Folder:$vmfo, Name:$name" >>$log
echo "Start Script..."
$zzah = get-random
echo "Import Module..."
echo "Import Module..." >>$log
Import-Module "C:\Program Files (x86)\VMware\Infrastructure\PowerCLI\Scripts\Initialize-PowerCLIEnvironment.ps1"
if ($?){
echo "success!!!"
}
else{
echo "error???"
exit
}
echo "Connect VCenter Server..."
echo "Connect VCenter Server..." >>$log ==>>This is the last message I get in the log when it runs the 2nd time!
Connect-VIServer -server server_ip -User Administrator -Password password -force -WarningAction SilentlyContinue >>$log
if ($?){ echo "success" } else {echo "error"}
Everything is working fine, script ends with "exit 0" so I guess the problem comes from the workflow and not from the script itself.
Any ideas to this issue?
PS: I just tested with a simple workflow consisting only of the "invoke external script" plugin and an added ps script with an echo as content and also this is executed twice.
So it seems to be a general problem/bug within the orchestrator application.
Thanks and Regards
Alu
ok, got it now.
it may be the problem with the powershell plugin. have a look into the following thread
Invoke a PowerShell script is executing the script twice
Technical preview version of VMware vCenter Powershell Plug-in 1.0.x
try aftger removing these two properties -force -WarningAction SilentlyContinue.
It will help us to see the events if the authentication fails and to confirm if its an authenticaiton issue.
Hi yezdi,
the authentication is fine because the script works the first time perfectly just it is started another time.
So it is started within the workflow twice although I need only 1 run.
I just tested with a simple ps script only doing an echo into a log file and nothing else and this script is also executed twice.
It could be a general bug in the orchestrator application.
I'm not sure if reinstalling helps or if I should try to contact an official vmware support.
ok, got it now.
it may be the problem with the powershell plugin. have a look into the following thread
Invoke a PowerShell script is executing the script twice
Technical preview version of VMware vCenter Powershell Plug-in 1.0.x
Ah, thank you, that was the problem^^
I wonder why I couldn't find that thread but anyways, its working now as expected