TwinCAT ADS Powershell Module

Manual Installation without Internet access

Because the TwinCAT XAE Management Powershell Module (TcXaeMgmt) is now available on the Powershell Gallery (https://www.powershellgallery.com/packages/TcXaeMgmt/) it is not necessary to activate the Powershell Module manually if Internet access available. For completeness and if no Internet is present the following steps show the manual installation process.

Check Installed Powershell Module

The TwinCAT Installation includes the setup for the Powershell TcXaeMgmt Module. It should already be existing under the folder

[TWINCATINSTALL]/AdsApi/Powershell/TcXaeMgmt

where [TWINCATINSTALL] indicates the TwinCAT root folder (c:\TwinCAT by default).

Check the Powershell Cmdlet Execution policy

What is left actually to the user is to activate that module in the Powershell environment.

PS> get-executionPolicy
Restricted

If the policy is not set to ‘Unrestricted’ or ‘RemoteSigned’, Powershell does not allow to process scripts or Cmdlets. For more information, please see

PS> get-help about_Execution_Policies

If the execution policy is restricted, it has to be set to ‘RemoteSigned’ by a Powershell console with administrative rights:

PS C:\tfs> Set-ExecutionPolicy RemoteSigned

Execution Policy Change
The execution policy helps protect you from scripts that you do not trust. Changing the execution policy might expose you to the security risks described in the about_Execution_Policies help topic at http://go.microsoft.com/fwlink/?LinkID=135170. Do you want to change the execution policy?
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "N"): y

Extend Powershell Module Search Path (PSModulePath)

As next step, the Powershell Search path for Powershell Modules must be extended, so that Powershell can find the TcXaeMgmt Cmdlets in the

[TWINCATINSTALL]/AdsApi/Powershell/

folder.

Please check the Enviroment variable ‘PSModulePath’:

PS> $env:PSModulePath
D:\Users\User\Documents\WindowsPowerShell\Modules\;C:\Program Files\WindowsPowerShell\Modules;C:\Windows\system32\WindowsPowerShell\v1.0\Modules\;

If the TwinCAT AdsApi path is not contained in the PSModulePath Variable, it should be set via the Windows Control Panel → System Properties → Advanced → Environment Variables Dialog.

Please add

[TWINCATINSTALLDIR]\AdsApi\Powershell\

e.g with

C:\TwinCAT\AdsApi\Powershell

to the System wide ‘PSModulePath’ Variable. After a Powershell Console restart, the new setting should be available:

PS C:\tfs> $env:PSModulePath
D:\Users\User\Documents\WindowsPowerShell\Modules\;C:\Program Files\WindowsPowerShell\Modules;C:\Windows\system32\WindowsPowerShell\v1.0\Modules;
c:\TwinCAT\AdsApi\Powershell\