Executing PowerShell Scripts
The Dynamic Code Editor is designed to work with either C#.NET or VB.NET.
To work with Windows PowerShell scripts simply use the ExecutePowerShellScriptFile method, passing the absolute path of the PowerShell script file to execute.
NOTE: The script will be executed under the context of the XIA Configuration Service Account or the Custom Credentials in use therefore the script file must be secured and not able to be modified by unauthorised users.
NOTE: The script must be executed After Agent Scan on the Plugin Properties otherwise the item property will be null.
The PowerShell script file can then be modified with the Windows PowerShell Integrated Scripting Environment (ISE) or another editor.
The script should accept the parameter $item which is the item being scanned by the XIA Configuration Client.
Add-Type -Path "C:\Program Files\CENTREL Solutions\XIA Configuration\XIA Configuration Service\CENTREL.XIA.Support.dll"
Add-Type -Path "C:\Program Files\CENTREL Solutions\XIA Configuration\XIA Configuration Service\CENTREL.XIA.Configuration.Types.dll"
The types should be added from the CENTREL.XIA.Support.dll and CENTREL.XIA.Configuration.Types.dll files, adjusting the paths as required. This allows the ISE to display the IntelliSense for these items.
To obtain more detailed information the item can be cast as the specific item type for example, the following would cast the item as a Windows machine item type.
$windowsMachine = [CENTREL.XIA.Configuration.Types.WindowsMachine]$item