Community forum

Please note that VisualCron support is not actively monitoring this community forum. Please use our contact page for contacting the VisualCron support directly.


stevja01
2022-01-21T15:48:09Z
Any status update re functionality to extract the details below to CSV or EXCEL? We are trying to use the Print Job report but it's a bit messy. The JOBS.XML is as well.

At a high level, we just need JOB NAME, TASK ORDER, TASK NAME, TASK TYPE so we can easily compare to a NEW deployment's same info to make sure we migrated the existing functionality to the new deployment.
Sponsor
Forum information
Gary_W
2022-01-21T16:47:40Z
That can be done with a powershell script that calls the API. I adapted a script I had that already traversed jobs/tasks to print what you want to STDOUT in a pipe-delimited format, ready for you to dump to a file or load into a spreadsheet. The meat is in the SearchTasks function. Works on 9.8.5.

STDOUT looks like this:

JOBNAME|TASKORDER|TASKNAME|TASKTYPE
Rate Conversions PROD|1|Copy files|CopyFile
Rate Conversions PROD|2|Excel - Convert|ExcelConvert
Rate Conversions PROD|3|Excel - Convert-Q2|ExcelConvert
Rate Conversions PROD|4|Excel - Convert-Q3|ExcelConvert
Rate Conversions PROD|5|Excel - Convert-Q4|ExcelConvert
Rate Conversions PROD|6|Get completed files|FilesList
Rate Conversions PROD|7|Set File to Load|VariableJobSet
Rate Conversions PROD|8|Run Load to DB|HTTP
Rate Conversions PROD|9|Copy files|CopyFile


##
## ListJobsTasks - List out active jobs and their tasks
##
# Get-VCAPIPath will get the path for VisualCron API DLLs
function Get-VCAPIPath
{
    $programFilesPath = if (${Env:PROCESSOR_ARCHITECTURE} -eq 'x86') { ${Env:ProgramFiles} } else { ${Env:ProgramFiles(x86)} }
    Join-Path $programFilesPath VisualCron\VisualCronAPI.dll
}

# Get-VCServer allows you to connect to the VisualCron Server
function Get-VCServer
{
    [CmdletBinding()]
    param ([string]$ComputerName, 
           [int]$Port,
           [System.Management.Automation.PSCredential]$Credential)

    $apiPath = Get-VCAPIPath
    if (!(Test-Path $apiPath)) { Throw "VisualCron does not appear to be installed. API library not found at `"$apiPath`"." }
    [Reflection.Assembly]::LoadFrom($apiPath) | Out-Null
    $conn = New-Object VisualCronAPI.Connection
    $conn.Address = if ([String]::IsNullOrEmpty($ComputerName)) { ${Env:COMPUTERNAME} } else { $ComputerName }
    if (!($credential -eq $null)) 
    {
        $conn.UseADLogon = $true
        $netcred = $credential.GetNetworkCredential()
        $conn.UserName = $netcred.UserName
        $conn.Password = $netcred.Password
    }
    $client = New-Object VisualCronAPI.Client
    $client.Connect($conn)
}

# Get-AllVCJobs returns a list of all the jobs in VisualCron server for the current machine
function Get-AllVCJobs
{
    [CmdletBinding()]
    param ([string]$ComputerName, 
           [int]$Port,
           [System.Management.Automation.PSCredential]$Credential,
           [switch]$Active)

    $ps = New-Object Collections.Hashtable($psBoundParameters)
    $ps.Remove('Active') | Out-Null
    # Connect to the Server
    $server = Get-VCServer @ps
    # Get all the jobs
    $server.Jobs.GetAll() `
    | ? { !($Active) -or $_.Stats.Active } `
    | Add-Member ScriptMethod Start { $server.Jobs.Run($this, $false, $false, $false, $null) }.GetNewClosure() -PassThru
}

function SearchTasks
{
    [CmdletBinding()]
    param ([string]$ComputerName, 
           [int]$Port,
           [System.Management.Automation.PSCredential]$Credential,
           [switch]$Active)

    $ps = New-Object Collections.Hashtable($psBoundParameters)
    $ps.Remove('Active') | Out-Null
    # Connect to the VisualCron server
    $server = Get-VCServer @ps

    # Get all the jobs
    $jobs = Get-AllVCJobs
    Write-Output ("JOBNAME" + "|" + "TASKORDER" + "|" + "TASKNAME" + "|" + "TASKTYPE")
    Foreach ($job in $jobs)
    {
      if ($job.stats.active -eq "True")
      {
        $tasks = $job.Tasks # Get the Jobs' Tasks
         Foreach ($task in $tasks)
         {
                 Write-Output ($job.Name + "|" + $task.order + "|" + $task.Name + "|" + $task.tasktype )
         }
      }  # End If job is active
    } # End foreach
    return
}  # End function SearchTasks

SearchTasks
Support
2022-01-24T13:58:26Z
Originally Posted by: stevja01 

Any status update re functionality to extract the details below to CSV or EXCEL? We are trying to use the Print Job report but it's a bit messy. The JOBS.XML is as well.

At a high level, we just need JOB NAME, TASK ORDER, TASK NAME, TASK TYPE so we can easily compare to a NEW deployment's same info to make sure we migrated the existing functionality to the new deployment.



Gary provided a good solution there for you. I hope that should be sufficient!
Michael
Support
http://www.visualcron.com 

Please like  VisualCron on facebook!
Scroll to Top