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.


Rami Aboulissane
2023-06-14T13:09:16Z
Hello,

We are trying to streamline our QA refresh process and part of my project is to automate exporting the settings of our Production VisualCron instance and then importing them onto our QA server.

I am playing around with the API via powershell and can see some useful classes such as the ExportImportProgressClass, however, i need to know what input is required.




For example when loading the VisualCronAPI.Server class I can see a ExportSettings objects but any value i enter is not accepted. Bear in mind i have no C# experience but this has pushed me to start learning about OOP



Any help is appreciated. I just need to export all settings as they are and nothing more granular at the moment. (Equivalent of going to File > export Settings > Start)

Im trying to attach images but it does not upload anything


function Load-VCAPIDLL {
param(
[Parameter()]
[string]$VCPath = "C:\Program Files (x86)\VisualCron\VisualCron.dll",

[Parameter()]
[string]$VCAPIPath = "C:\Program Files (x86)\VisualCron\VisualCronAPI.dll"
)

$VC = [Reflection.Assembly]::LoadFrom($VCPath);
$VCAPI = [Reflection.Assembly]::LoadFrom($VCAPIPath);
}

#Returns a VisualCronAPI.Server object that can be used to interact with target VisualCron server.
function ConnectTo-VCServer {
param(
[Parameter(Mandatory=$true)]
[string]$username,

[Parameter(Mandatory=$true )]
[string]$password,

[Parameter( Mandatory=$true)]
[alias("address")]
[string]$VCServerAddress,

[Parameter( Mandatory=$true )]
[alias("connection")]
[string]$VCServerConntype,

[Parameter()]
[alias("port")]
[string]$VCServerPort
)

#Call the dll loading fn
Load-VCAPIDLL

#Create new connection objects
$ClientConnectionObj =New-Object -TypeName VisualCronAPI.Client
$ServerConnectionObj = New-Object -TypeName VisualCronAPI.Server
$APIConnectionObj = New-Object -TypeName VisualCronAPI.Connection

#Assign provided params to APIConnectionObj
$APIConnectionObj.Address = $VCServerAddress
$APIConnectionObj.UserName = $username
$APIConnectionObj.PassWord = $password

if ($VCServerPort -ne $null)
{
$APIConnectionObj.Port
}

$APIConnectionObj.ConnectionType = $VCServerConntype

#Using the ClientConnectionObj, pass in the APIConnectionObj to update ServerConnectionObj.
#This creates a connection to the target VisualCron server.
$ServerConnectionObj = $ClientConnectionObj.Connect($APIConnectionObj, $true)

#Return VisualCronAPI.Server object
Return $ServerConnectionObj
}


I then connect to the server and then I do the follow

$global:Server = New-Object VisualCronAPI.Server
$global:Server.ExportSettings()

But i get lost here

I can add the following too

$importexport = New-Object VisualCron.ExportImportProgressClass
and this shows the options for the export of settings it seems such as UseDefaultFile (Guessing the default file location to export settings zip file) IncludeallJobs etc etc

Can anyone help a newbie please? on the VisualCronAPI.PDF on VC's website i see a Namespaces >VisualCronAPI screenshot which shows detailed descriptions of each object such as Add(JobClass) : Adds a job, Activate(JobClass) : Activates a Job etc

Anyone know the link to access this Namespaces as well? I think that has the information I need.
Sponsor
Forum information
Users browsing this topic
Scroll to Top