Microsoft Windows Remote Management (WinRM) enables you to remotely perform various management tasks, such as running batch scripts, PowerShell scripts, and uploading files.
Microsoft WinRM connector is for the WinRM service that allows you to invoke commands on targeted Windows machines from any machine that can run Python.
This document provides information about the Microsoft WinRM connector, which provides an interface to connect with a Windows server and remotely execute commands on a Microsoft WinRM server using FortiSOAR™ playbooks. Add the Microsoft WinRM connector as a step in FortiSOAR™ playbooks and perform automated operations, such as executing commands, PowerShell (PS) commands, and scripts, and uploading a script file to a windows machine.
Connector Version: 1.0.2
FortiSOAR™ Version Tested on: 6.0.0-790
Authored By: Fortinet
Certified: Yes
Following enhancements have been made to the Microsoft WinRM Connector in version 1.0.2:
From FortiSOAR™ 5.0.0 onwards, use the Connector Store to install the connector. For the detailed procedure to install a connector, click here.
You can also use the yum command to install connectors. Connectors provided by FortiSOAR™ are delivered using a FortiSOAR™ repository. Therefore, you must set up your FortiSOAR™ repository and run the yum command as a root user to install connectors:
yum install cyops-connector-microsoft-winrm
To use this connector, you must configure WinRM on the Windows server to which you want to connect. To configure WinRM, do the following:
c:\> winrm quickconfig
c:\> winrm e winrm/config/listener
c:\> winrm get winrm/config/service
Run the following command to enable basic authentication.
c:\> winrm set winrm/config/service/auth @{Basic="true"}
Run the following command to allow transfer of unencrypted data on the WinRM service.
c:\> winrm set winrm/config/service @{AllowUnencrypted="true"}
If the channel binding token hardening level of the WinRM service is set to strict, change its value to relaxed.
c:\> winrm set winrm/config/service/auth @{CbtHardeningLevel="relaxed"}
Enable basic authentication on the WinRM client.
Run the following command to check whether basic authentication is allowed.
c:\> winrm get winrm/config/client
Run the following command to enable basic authentication.
c:\> winrm set winrm/config/client/auth @{Basic="true"}
Run the following command to allow the transfer of unencrypted data on the WinRM client.
c:\> winrm set winrm/config/client @{AllowUnencrypted="true"}
If the WinRM host machine is in an external domain, run the following command to specify the trusted hosts.
c:\> winrm set winrm/config/client @{TrustedHosts="host1, host2, host3"}
Run the following command to test the connector to the WinRM service.
c:\> winrm identity -r:http://winrm_server:5985 -auth:basic -u:user_name -p:password -encoding:utf-8
For the procedure to configure a connector, click here.
In FortiSOAR™, on the Connectors page, click the Microsoft WinRM connector row (if you are in the Grid view on the Connectors page) and in the Configurations tab enter the required configuration details:
Parameter | Description |
---|---|
Username | Username used to connect to the Windows server to which you will connect and perform automated operations. |
Password | Password used to connect to the Windows server to which you will connect and perform automated operations. |
Verify SSL | Specifies whether the SSL certificate for the server is to be verified or not. By default, this option is set as True . |
The following automated operations can be included in playbooks, and you can also use the annotations to access operations from FortiSOAR™ release 4.10.0 onwards:
Function | Description | Annotation and Category |
---|---|---|
Run Command | Runs the command you specify on the windows machine you have specified. | execute_command Miscellaneous |
Run Powershell Command | Runs the Powershell command you specify on the windows machine you have specified. | execute_command Miscellaneous |
Run Inline Powershell Script | Runs a series of Powershell commands you specify that can execute multiple lines of Powershell, without requiring the script to be saved as an "Attachment" record, on the windows machine you have specified. | execute_ps_script Miscellaneous |
Run Script | Runs the script that is saved as an "Attachment" record on the windows machine you have specified. | execute_command Miscellaneous |
Upload File To Endpoint | Uploads the provided script file to the location you specify on the windows machine you have specified. | upload_file_to_endpoint Miscellaneous |
Parameter | Description |
---|---|
Command | Command that you want to execute remotely. |
IP Address | IP address of the windows machine on which you want to execute the command. |
Protocol | Protocol used for the remote connection, choose between http or https. |
Port | (Optional) Port number used for connecting to the Windows server. Default port for http is 5985, and the default port for https is 5986. |
The JSON output contains the output of the command, which is dependent on the command that you execute.
The output contains the following populated JSON schema:
{
"op_result": "",
"op_status": ""
}
Parameter | Description |
---|---|
Command | Powershell command that you want to execute remotely. |
IP Address | IP address of the windows machine on which you want to execute the command. |
Protocol | Protocol used for the remote connection, choose between http or https. |
Port | (Optional) Port number used for connecting to the Windows server. The default port for http is 5985, and the default port for https is 5986. |
Convert to JSON | Select this option to convert the command output to the JSON format. By default, this is set to True . |
The JSON output contains the output of the Powershell command, which is dependent on the command that you execute.
The output contains the following populated JSON schema:
{
"op_result": "",
"op_status": ""
}
Parameter | Description |
---|---|
Command | Series of Powershell command(s) that you want to execute remotely. This operation can that can execute multiple lines of Powershell, without requiring the script to be saved as an "Attachment" record. |
IP Address | IP address of the windows machine on which you want to execute the command(s). |
Protocol | Protocol used for the remote connection, choose between http or https. |
Port | (Optional) Port number used for connecting to the Windows server. The default port for http is 5985, and the default port for https is 5986. |
The output contains the following populated JSON schema:
{
"op_result": "",
"op_status": ""
}
Parameter | Description |
---|---|
Attachment IRI | Attachment IRI of the script file which is used to submit files directly from the FortiSOAR™ Attachments module to the Windows server. |
IP Address | IP address of the windows machine on which you want to execute the script. |
Protocol | Protocol used for the remote connection, choose between http or https. |
Port | (Optional) Port number used for connecting to the Windows server. The default port for http is 5985, and the default port for https is 5986. |
The JSON output contains the output of the script, which is dependent on the script that you execute.
The output contains the following populated JSON schema:
{
"op_result": "",
"op_status": ""
}
Parameter | Description |
---|---|
Absolute File Path | Complete location on the windows machine where you want to save the script file. |
Attachment IRI | Attachment IRI of the script file which is used to upload files directly from the FortiSOAR™ Attachments module to the Windows server. |
IP Address | IP address of the windows machine to which you want to upload the PS script. |
Protocol | Protocol used for the remote connection, choose between http or https. |
Port | (Optional) Port number used for connecting to the Windows server. Default port for http is 5985, and the default port for https is 5986. |
The JSON output contains a Success
message and the location of where the script is uploaded if the script file is uploaded successfully or an Error
message containing the reason for failure.
No output schema is available at this time.
The Sample - Microsoft WinRM - 1.0.2
playbook collection comes bundled with the Microsoft WinRM connector. This playbook contains steps using which you can perform all supported actions. You can see the bundled playbooks in the Automation > Playbooks section in FortiSOAR™ after importing the Microsoft WinRM connector.
Note: If you are planning to use any of the sample playbooks in your environment, ensure that you clone those playbooks and move them to a different collection since the sample playbook collection gets deleted during connector upgrade and delete.
Microsoft Windows Remote Management (WinRM) enables you to remotely perform various management tasks, such as running batch scripts, PowerShell scripts, and uploading files.
Microsoft WinRM connector is for the WinRM service that allows you to invoke commands on targeted Windows machines from any machine that can run Python.
This document provides information about the Microsoft WinRM connector, which provides an interface to connect with a Windows server and remotely execute commands on a Microsoft WinRM server using FortiSOAR™ playbooks. Add the Microsoft WinRM connector as a step in FortiSOAR™ playbooks and perform automated operations, such as executing commands, PowerShell (PS) commands, and scripts, and uploading a script file to a windows machine.
Connector Version: 1.0.2
FortiSOAR™ Version Tested on: 6.0.0-790
Authored By: Fortinet
Certified: Yes
Following enhancements have been made to the Microsoft WinRM Connector in version 1.0.2:
From FortiSOAR™ 5.0.0 onwards, use the Connector Store to install the connector. For the detailed procedure to install a connector, click here.
You can also use the yum command to install connectors. Connectors provided by FortiSOAR™ are delivered using a FortiSOAR™ repository. Therefore, you must set up your FortiSOAR™ repository and run the yum command as a root user to install connectors:
yum install cyops-connector-microsoft-winrm
To use this connector, you must configure WinRM on the Windows server to which you want to connect. To configure WinRM, do the following:
c:\> winrm quickconfig
c:\> winrm e winrm/config/listener
c:\> winrm get winrm/config/service
Run the following command to enable basic authentication.
c:\> winrm set winrm/config/service/auth @{Basic="true"}
Run the following command to allow transfer of unencrypted data on the WinRM service.
c:\> winrm set winrm/config/service @{AllowUnencrypted="true"}
If the channel binding token hardening level of the WinRM service is set to strict, change its value to relaxed.
c:\> winrm set winrm/config/service/auth @{CbtHardeningLevel="relaxed"}
Enable basic authentication on the WinRM client.
Run the following command to check whether basic authentication is allowed.
c:\> winrm get winrm/config/client
Run the following command to enable basic authentication.
c:\> winrm set winrm/config/client/auth @{Basic="true"}
Run the following command to allow the transfer of unencrypted data on the WinRM client.
c:\> winrm set winrm/config/client @{AllowUnencrypted="true"}
If the WinRM host machine is in an external domain, run the following command to specify the trusted hosts.
c:\> winrm set winrm/config/client @{TrustedHosts="host1, host2, host3"}
Run the following command to test the connector to the WinRM service.
c:\> winrm identity -r:http://winrm_server:5985 -auth:basic -u:user_name -p:password -encoding:utf-8
For the procedure to configure a connector, click here.
In FortiSOAR™, on the Connectors page, click the Microsoft WinRM connector row (if you are in the Grid view on the Connectors page) and in the Configurations tab enter the required configuration details:
Parameter | Description |
---|---|
Username | Username used to connect to the Windows server to which you will connect and perform automated operations. |
Password | Password used to connect to the Windows server to which you will connect and perform automated operations. |
Verify SSL | Specifies whether the SSL certificate for the server is to be verified or not. By default, this option is set as True . |
The following automated operations can be included in playbooks, and you can also use the annotations to access operations from FortiSOAR™ release 4.10.0 onwards:
Function | Description | Annotation and Category |
---|---|---|
Run Command | Runs the command you specify on the windows machine you have specified. | execute_command Miscellaneous |
Run Powershell Command | Runs the Powershell command you specify on the windows machine you have specified. | execute_command Miscellaneous |
Run Inline Powershell Script | Runs a series of Powershell commands you specify that can execute multiple lines of Powershell, without requiring the script to be saved as an "Attachment" record, on the windows machine you have specified. | execute_ps_script Miscellaneous |
Run Script | Runs the script that is saved as an "Attachment" record on the windows machine you have specified. | execute_command Miscellaneous |
Upload File To Endpoint | Uploads the provided script file to the location you specify on the windows machine you have specified. | upload_file_to_endpoint Miscellaneous |
Parameter | Description |
---|---|
Command | Command that you want to execute remotely. |
IP Address | IP address of the windows machine on which you want to execute the command. |
Protocol | Protocol used for the remote connection, choose between http or https. |
Port | (Optional) Port number used for connecting to the Windows server. Default port for http is 5985, and the default port for https is 5986. |
The JSON output contains the output of the command, which is dependent on the command that you execute.
The output contains the following populated JSON schema:
{
"op_result": "",
"op_status": ""
}
Parameter | Description |
---|---|
Command | Powershell command that you want to execute remotely. |
IP Address | IP address of the windows machine on which you want to execute the command. |
Protocol | Protocol used for the remote connection, choose between http or https. |
Port | (Optional) Port number used for connecting to the Windows server. The default port for http is 5985, and the default port for https is 5986. |
Convert to JSON | Select this option to convert the command output to the JSON format. By default, this is set to True . |
The JSON output contains the output of the Powershell command, which is dependent on the command that you execute.
The output contains the following populated JSON schema:
{
"op_result": "",
"op_status": ""
}
Parameter | Description |
---|---|
Command | Series of Powershell command(s) that you want to execute remotely. This operation can that can execute multiple lines of Powershell, without requiring the script to be saved as an "Attachment" record. |
IP Address | IP address of the windows machine on which you want to execute the command(s). |
Protocol | Protocol used for the remote connection, choose between http or https. |
Port | (Optional) Port number used for connecting to the Windows server. The default port for http is 5985, and the default port for https is 5986. |
The output contains the following populated JSON schema:
{
"op_result": "",
"op_status": ""
}
Parameter | Description |
---|---|
Attachment IRI | Attachment IRI of the script file which is used to submit files directly from the FortiSOAR™ Attachments module to the Windows server. |
IP Address | IP address of the windows machine on which you want to execute the script. |
Protocol | Protocol used for the remote connection, choose between http or https. |
Port | (Optional) Port number used for connecting to the Windows server. The default port for http is 5985, and the default port for https is 5986. |
The JSON output contains the output of the script, which is dependent on the script that you execute.
The output contains the following populated JSON schema:
{
"op_result": "",
"op_status": ""
}
Parameter | Description |
---|---|
Absolute File Path | Complete location on the windows machine where you want to save the script file. |
Attachment IRI | Attachment IRI of the script file which is used to upload files directly from the FortiSOAR™ Attachments module to the Windows server. |
IP Address | IP address of the windows machine to which you want to upload the PS script. |
Protocol | Protocol used for the remote connection, choose between http or https. |
Port | (Optional) Port number used for connecting to the Windows server. Default port for http is 5985, and the default port for https is 5986. |
The JSON output contains a Success
message and the location of where the script is uploaded if the script file is uploaded successfully or an Error
message containing the reason for failure.
No output schema is available at this time.
The Sample - Microsoft WinRM - 1.0.2
playbook collection comes bundled with the Microsoft WinRM connector. This playbook contains steps using which you can perform all supported actions. You can see the bundled playbooks in the Automation > Playbooks section in FortiSOAR™ after importing the Microsoft WinRM connector.
Note: If you are planning to use any of the sample playbooks in your environment, ensure that you clone those playbooks and move them to a different collection since the sample playbook collection gets deleted during connector upgrade and delete.