5.6.3 - PowerShell Extensions

Follow

Proventeq Migration Accelerator comes with a default PowerShell module called Proventeq.MigrationAccelerator.PowerShell.Module, which is delivered using the module manifest file Proventeq.MigrationAccelerator.PowerShell.Module.psd1. This has a default sub-module, called Proventeq.MigrationAccelerator.PowerShell.DefaultModule.psm1, which is an empty module (with one sample function).

In addition to writing PowerShell rules within the client UI, Proventeq Migration Accelerator provides the option to import custom PowerShell modules. This can be done in the following ways

5.6.3.1.     Upgrading the default module

Any custom functions and scripts can be written in the Proventeq.MigrationAccelerator.PowerShell.DefaultModule.psm1. These scripts and functions will be available in the Rule editor window in the client UI. Variables that are needed in the script during execution should be declared as a global variable e.g. $global:MyVariable

5.6.3.1.    Creating new modules

A new PowerShell module can be created and included in the Proventeq Migration Accelerator Module manifest file as a nested module.

  1. Create a new PowerShell module file (PSM1 file)
  2. Create new functions and scripts in this module file
  3. Update the NestedModuleList property of MigrationAccelerator.PowerShell.Module.psd1 file to include this new module.

5.6.3.3.     Importing metadata from CSV  file

Metadata can be imported into Proventeq Migration Accelerator using the method specified in “Upgrading the default module” section.

Create a CSV file with a unique Item ID column, and columns for all the metadata associated with the item. Ensure the CSV file has headers.

 

ID,

Metadata_1,

Metadata_2,

Metadata_3

0001,

M1_value_1,

M2_Value_1,

M3_Value_1

0002,

M1_value_2,

M2_Value_2,

M3_Value_2

0003,

M1_value_3,

M2_Value_3,

M3_Value_3

 

Create a global variable and import the CSV

$global:CSVMetadata = Import-CSV  -path ‘<My csv path>’

In the Script mapping dialog, access the metadata by selecting the appropriate row by filtering it on the unique ID.

 

$meta = $global:CSVMetadata | ?{$_.ID –eq  <My unique ID>}
$meta.Metadata_1

 

 

Was this article helpful?
0 out of 0 found this helpful

Comments