Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
devel:documentation:systems:dev:winrm_connector [2019/06/12 11:36] kucerar link to winrm config |
devel:documentation:systems:dev:winrm_connector [2019/07/10 06:52] kucerar roles, script tips |
||
---|---|---|---|
Line 1: | Line 1: | ||
====== WinRM Connector ====== | ====== WinRM Connector ====== | ||
- | This connector can be used to connect to basically to any system which can be managed via powershell commands or some specialized client which can be called from powershell. | + | Windows Remote Management (WinRM) |
Connector is based on Connid CMD connector. We made fork of CMD connector version 0.4-SNAPSHOT. | Connector is based on Connid CMD connector. We made fork of CMD connector version 0.4-SNAPSHOT. | ||
Line 36: | Line 36: | ||
===== Configuration ===== | ===== Configuration ===== | ||
Connector has few settings which need to be configured before you used it. | Connector has few settings which need to be configured before you used it. | ||
+ | |||
+ | If your connector server is running on Windows then you need to enter " | ||
=== Create script === | === Create script === | ||
Line 98: | Line 100: | ||
| \_\_ACCOUNT\_\_ | | \_\_ACCOUNT\_\_ | ||
| \_\_GROUP\_\_ | | \_\_GROUP\_\_ | ||
+ | |||
+ | ===== Managing users groups ===== | ||
+ | When you use this connector for some system where you need to manage groups for users (OpenLims). Attribute for roles must be called " | ||
+ | |||
+ | ===== Scripts ===== | ||
+ | ==== python ==== | ||
+ | Python scripts should start with these two lines: | ||
+ | < | ||
+ | # -*- coding: utf-8 -*-</ | ||
+ | |||
+ | The second line is important because in python 2.x default encoding is ASCII so if don't specify the encoding in python file then we will have problems with using diacritics. | ||
+ | Then if we need to load powershell script into python and replace some params, It's recommended to open with encoding. | ||
+ | < | ||
+ | import codecs | ||
+ | f = codecs.open(os.environ[" | ||
+ | command = f.read() | ||
+ | command = command.replace(" | ||
+ | </ | ||
+ | For getting parameter from environment you can use method in winrm_wrapper which will return value or empty string if the variable is not in environment. It will return value as unicode with utf-8 encoding | ||
+ | |||
+ | We are using encoding otherwise you will have problem with diacritics in powershell when you want to encode the powershell script before sending it via WinRM. | ||
+ | |||
===== Installation ===== | ===== Installation ===== | ||
Line 119: | Line 143: | ||
You will probably need to add these libs into classpath in ConnectorServer.sh or ConnectorServer.bat it depends on your OS. | You will probably need to add these libs into classpath in ConnectorServer.sh or ConnectorServer.bat it depends on your OS. | ||
- | Now you can put winrm-connector-0.5.jar to the bundles folder inside connector server and you can start it. | + | Now you can put winrm-connector-1.0.0.jar to the bundles folder inside connector server and you can start it. |
Next thing which you need to do is configure WinRM on windows server or check if WinRM is accessible. You can follow steps from out [[tutorial: | Next thing which you need to do is configure WinRM on windows server or check if WinRM is accessible. You can follow steps from out [[tutorial: |