This sample script shows how a connection to powerGateServer can be established automatically when Vault users log in to Vault from within Vault Client or Inventor.
The location of the powerGateServer is determined based on the name of the Vault that is connected to:

  • When connecting to a Vault named “TestVault” the services setup up on the local powerGateServer environment are connected (they may still be under development).

  • When connecting to Vaults with other names it is assumed that the powerGateServer is running on the same machine as the Vault Server


Regardless of the names of the installed services on the powerGateServer, the event script connects to its CatalogService.

By default powerGateServer installations contain an ERP Plugin, which can then be used for test purpose.
As soon as custom plugins are available on the local test system, only these services are automatically connected (ensure these plugins connect to the test-ERP system).
In both situations the creation of a Vault called “TestVault” allows to ensure that the application is connected to the test ERP system, by simply logging out and back into this new Vault.

To avoid error situations on productive environments (e.g. if the installation of such custom plugins was forgotten) it is recommended to install powerGateServer without the sample ‘ERP plugin’ on productive environments!


When customizing the script, it is recommended to disable the default sample, create a copy of it and customize the copy.

The script registers to the LoginVault_Post event and tries to connect to a powerGateServer using Connect-ERP.
Which Vault name maps to which powerGateServer service URLs can be customized by adapting the following section:

Register-VaultEvent -EventName LoginVault_Post -Action {

	# To configure for example to connect to individual services for a Vault named ‘Testing’
	if($vaultConnection.Vault -eq 'Testing') {
		$connected = Connect-ERP -Service 'https://sap_test_environment/sap/opu/odata/arcona6/MATERIAL_SRV' -OnConnect $global:sapConnect
		$connected = Connect-ERP -Service 'https://sap_test_environment/sap/opu/odata/arcona6/BILL_OF_MATERIAL_SRV' -OnConnect $global:sapConnect

Disabling the script

In the default delivery the event registration for this script is enabled only in the Vault Client and Inventor.
Therefore its always disabled for the Job Processor and connections to the powerGateServer will not be available in powerJobs Processor jobs.

To globally disable the execution of the script, move the file %PROGRAMDATA%\coolOrange\powerEvents\Events\Sample.ConnectToPowerGateServer.ps1 to the %PROGRAMDATA%\coolOrange\powerEvents\Events\Disabled directory.