Where to quickly get the list of Task-ID () - VisualCron - Forum

Community forum

Eddie Kumar
2018-01-08T10:35:15Z
Hi,

Where can we quickly get the list of Task-IDs? Without having to navigate through each tasks in the Variables window (in the Global Variables (window) -> VisualCorn variables -> Jobs -> Active jobs -> Tasks -> JobId --- this is very time taking).

Basically, we have a long job that contains many tasks (more than 50 tasks), we needed to clone it (to achieve similar functionality), there are lots of tasks that refer to other tasks (in the same job) using absolute reference i.e. using the Task-ids GUIDs (instead of using relative references such as Next/PrevTask etc.)

Problem:
After cloning the job, the tasks in the new cloned copy hold the old task-ids (i.e. point/refer to the tasks in the old job that require manual fixing), what we need is list of task-ids (of the tasks) in both the old & new jobs, so that we can replace the old task-ids with the new ones (by doing a side-by-side comparison).

Therefore wondering if there is a way to derive the list of Task-IDs of ALL tasks in a job?
Also is task-id available anywhere in the "Edit Task" window (without having to open the Variable window)?

TIA
ErikC
2018-01-09T08:28:07Z
Hi Eddie,

I'll move this to the API section of the forum, that's the way to go here I believe.
What you can do is use this Powershell script I made. Just make a Powershell task and add two parameters to it.
Name them VCpath and VCAPIpath and add the full path to both dll's in your visualcron install folder (visualcron.dll + visualcronapi.dll).
You can change the connection settings in the script.

The output will be: jobname;taskname;taskid

Good luck!

Regards,
Erik

Param(
	[string] $VCpath,
	[string] $VCAPIpath
)
  
# Load the VisualCron API Dlls
$VC = [Reflection.Assembly]::LoadFrom($VCpath);
$VCAPI = [Reflection.Assembly]::LoadFrom($VCAPIpath);

# Define Client & Server Objects
$Global:Client = New-Object -TypeName VisualCronAPI.Client
$Global:Server = New-Object -TypeName VisualCronAPI.Server

# Define Connection Object
$Conn = New-Object -TypeName VisualCronAPI.Connection

# Set Connection Values
$Conn.Address = 'localhost'
$Conn.UserName = 'admin'
$Conn.PassWord = ''
$Conn.Port = 16444
$Conn.ConnectionType = 'Local'

# If connecting to localhost, check VisualCron Service is running (useful for cluster installations)
If ($Conn.Address -like 'localhost' -and -not (Get-Process VisualCronService -ErrorAction SilentlyContinue)) {
	Write-Output "2 VisualCron ExecTime=0 Error: VisualCron service not running"
	exit
}

# Try to Connect to the VisualCron Server
try {
	$Global:Server = $Client.Connect($conn, $true);
}
catch {
	Write-Output "2 VisualCron ExecTime=0 Error: Could Not Connect to VisualCron Server"
}

# Get the jobs
$jobs = $Global:Server.jobs.GetAll()

# Run through them 
foreach ($job in $jobs) {
	# Run through all the tasks
	foreach($task in $job.Tasks)
	{
		Write-Output ($job.Name +";"+$task.Name+";"+$task.Id )
	}
}

Uses Visualcron since 2006.
bweston
2018-01-16T17:19:00Z
Also potentially useful: in 8.2.9, at least, at the bottom left of any job or task edit window, I see "Copy Job Id" or "Copy Task Id" which puts the ID on the clipboard.

<silly>I have not found a way to copy the job's or task's ego or superego directly to the clipboard.</silly>
Eddie Kumar
2019-04-18T14:38:33Z
Hi Erik,

Thanks for your time, sorry I couldn't come back to this earlier, I created the PowerShell task along with the suggested Parameters, however I'm getting "Access Denied" although I have admin access level. This is perhaps due to the fact that I authenticate using ActiveDirectory (without password), so how can I used the " Integrated Security=true" please instead of "$Conn.PassWord=" .

TIA
Eddie
bweston
2019-04-18T14:42:16Z
Originally Posted by: Eddie Kumar 

Hi Erik,

Thanks for your time, sorry I couldn't come back to this earlier, I created the PowerShell task along with the suggested Parameters, however I'm getting "Access Denied" although I have admin access level. This is perhaps due to the fact that I authenticate using ActiveDirectory (without password), so how can I used the " Integrated Security=true" please instead of "$Conn.PassWord=" .

TIA
Eddie



$conn.UseADLogon = $true
instead of username and password, but then you need to run using the credential of a user with Visualcron access.
Scroll to Top