Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents

Introduction

The AD/LDAP connector has ability to execute remote commands and PowerShell scripts on Windows machines using the Windows remote management interfaces (WinRM/WS-Man).

...

There are currently two "languages" supported by the connector scripting capability:


Language nameInterpreted byDescription
cmdcmd.exeExecuting simple Windows commands.
powershellPowerShellPowerShell commands, each executed separately in its own PowerShell instance. This requires additional overhead to execute powershell.
powerhellPowerShellPowerShell commans executed in one PowerShell instance. This forms a quasi-session. The PowerShell interpreter is executed and initialized only once. Then the commands are sent to the PowerShell one by one.
WARNING: All the commands share the same PowerShell, so they can influence each other (e.g. they are using the same variables). Be careful.
exchangePowerShell (Exchange)PowerShell commans executed in one PowerShell instance which has been initialized with Exchange snap-ins.
WARNING: All the commands share the same PowerShell, so they can influence each other (e.g. they are using the same variables). Be careful.

Script arguments

Passing arguments to the script can have two different formats. Which of the formats is used is based upon AD resource attribute powershellArgumentStyle.

powershellArgumentStyle
FormatDescription
dashed (default)command -arg1 val1 -arg2 val2

The arguments are encoded in the commands in a windows-like dashed form.

Final command example: "jump.bat -height 100 -distance 200"

variables$arg1 = 'val1'; command

This option is convenient for more complex commands, where arguments are used inline.

Connector sets arguments as powershell variables, that can be then read with $ notation.

Example: see bellow

Please note that command represents <code></code> part of the script.

...