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

I am trying to create a function that Exports all settings in VisualCron via Powershell through VisualCron API

I first create a function to load the DLLS

Then I create the function to establish a connection

These work fine

I however struggle with inputing a value in the ExportSettings() method that is accepted. I always get a null value no matter what I try.

#Function that loads VisualCron's API dlls.
function Load-VCAPIDLL {
[string]$VCPath = "C:\Program Files (x86)\VisualCron\VisualCron.dll",

[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 {

[Parameter(Mandatory=$true )]

[Parameter( Mandatory=$true)]

[Parameter( Mandatory=$true )]


#Call the dll loading fn

#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.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

##Export VisualCron settings to import in QA environment

function Export-VCSettings {

[Parameter(Mandatory=$true )]

[Parameter( Mandatory=$true)]

[Parameter( Mandatory=$true )]





$global:Server = New-Object VisualCronAPI.Server
$eip = New-Object VisualCron.ExportImportProgressClass
$eip.UseDefaultFile = $Usedefaultfile
$eip.IncludeAllCertificates = "true"
$eip.IncludeAllConnections = $IncludeallConnections
$eip.IncludeAllCredentials = $IncludeAllCredentials,
$eip.IncludeAllServerSettings = $IncludeAllServerSettings
$eip.IncludeAllJobs = $IncludeAllJobs
$eip.IncludeAllPermissions = $IncludeallPermissions
$eip.JobObjects = $

$escr = New-Object VisualCron.ExportSettingsResponseClass
$escr = $global:Server.ExportSettings($eip)

if ($escr.Success -and $escr.FileBytes -ne 'null') {

[system.IO.File.Writeallbytes]::("c:\", $escr.FileBytes)


However it keeps telling me the below

You cannot call a method on a null-valued expression.
At line:47 char:1
+ $escr = $global:Server.ExportSettings($eip)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull

I was basing this off of a C# example someone had posted


Any ideas what I need to put in the ExportSettings method as a value? I thought passing through the variables for the ExportImportProgress class

Forum information
Rami Aboulissane
Does anyone still use these forums?
Not sure to be honest. There is so much spam in the forum now, that it is becoming unusable. Since VC Support has abandoned the forum, maybe it would be an idea for the registered (real) users to create a Discord og Slack channel for helping each other out.

Anyway, I can't help you with powershell unfortunaltely
Scroll to Top