Fortinet white logo
Fortinet white logo

Microsoft WinRM

Microsoft WinRM v2.0.0

About the connector

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.

Version information

Connector Version: 2.0.0

FortiSOAR™ Version Tested on: 7.6.0-5012

Microsoft WinRM Version Tested on:

Authored By: Fortinet

Certified: Yes

Release Notes for version 2.0.0

Following enhancements have been made to the Microsoft WinRM connector in version 2.0.0:

  • Added the following new operations and playbooks:
    • Get File
  • Added support for all file types to upload to a windows server through the connector action Upload File.
  • Moved the following parameters to a common place — configuration parameters:
    • IP Address(Host)
    • Protocol
    • Port

Installing the connector

Use the Content Hub to install the connector. For the detailed procedure to install a connector, click here.

You can also use the yum command as a root user to install the connector:

yum install cyops-connector-microsoft-winrm

Prerequisites to configuring the connector

  • You must have the username and password of the Windows server you want to connect to and perform automated operations.
  • To run a Powershell Command action, you must have Powershell version 3.0 and later installed on your instance.
  • To access the FortiSOAR™ UI, ensure that port 443 is open through the firewall for the FortiSOAR™ instance.
  • You must configure WinRM on the Windows server to which you want to connect and use this connector, see the Configuring WinRM on a Windows server section for details.

Minimum Permissions Required

  • Not applicable

Configuring the connector

For the procedure to configure a connector, click here

Configuration parameters

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
Protocol Select the protocol to use for the remote connection. You can choose from the following options:
  • http
  • https
Host Specify the IP address of the windows machine on which to execute the command.
Port Specify the port number to connect to the Windows server. Default port for http is 5985, and for https is 5986.
Authentication Type Specify the type for authentication. Authentication type can be basic, ntlm, or credssp.

NOTE: You may encounter an error when using NTLM authentication type. For resolution, refer to the community article Exchange/Microsoft WinRM Connector - Error: unsupported hash type md4.

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.
By default, this option is selected, i.e., set to true.

Actions supported by the connector

You can use the following automated operations in playbooks and also use the annotations to access operations:

Function Description Annotation and Category
Get File Gets a file from windows machine that you have specified. get_file
Miscellaneous
Run Command Runs the specified command on the configured Windows machine. execute_command
Miscellaneous
Run Powershell Command Executes the given Powershell command on the configured Windows machine. execute_command
Miscellaneous
Run Inline Powershell Script Execute a series of Powershell commands on multiple lines without saving the script as an Attachment record. execute_ps_script
Miscellaneous
Run Script Executes the script you specify on the configured Windows machine. execute_command
Miscellaneous
Upload File To Endpoint Uploads the specified file to the specified remote location on the Windows machine. upload_file_to_endpoint
Miscellaneous

operation: Get File

Input parameters

Parameter Description
Absolute File Path Specify the filepath on the remote machine from which to fetch the file.
Create Attachment (Optional) Select to create the file as an attachment in FortiSOAR's Attachments module. By default, this option is selected, i.e. set to True. Clear this checkbox to create the copied file as a file record.

Output

The output contains the following populated JSON schema:

Output schema when you choose "Create Attachment" as "true":

{
    "id": "",
    "@id": "",
    "file": {
        "id": "",
        "@id": "",
        "size": "",
        "uuid": "",
        "@type": "",
        "assignee": "",
        "filename": "",
        "metadata": [],
        "mimeType": "",
        "thumbnail": "",
        "uploadDate": ""
    },
    "name": "",
    "type": "",
    "uuid": "",
    "@type": "",
    "tasks": [],
    "alerts": [],
    "assets": [],
    "owners": [],
    "people": [],
    "@context": "",
    "assignee": "",
    "comments": [],
    "warrooms": [],
    "incidents": [],
    "createDate": "",
    "createUser": {
        "id": "",
        "@id": "",
        "name": "",
        "uuid": "",
        "@type": "",
        "avatar": "",
        "userId": "",
        "userType": "",
        "createDate": "",
        "createUser": "",
        "modifyDate": "",
        "modifyUser": ""
    },
    "indicators": [],
    "modifyDate": "",
    "modifyUser": {
        "id": "",
        "@id": "",
        "name": "",
        "uuid": "",
        "@type": "",
        "avatar": "",
        "userId": "",
        "userType": "",
        "createDate": "",
        "createUser": "",
        "modifyDate": "",
        "modifyUser": ""
    },
    "recordTags": [],
    "userOwners": [],
    "workspaces": [],
    "description": ""
}

Output schema when you choose "Create Attachment" as "false":

{
    "id": "",
    "@id": "",
    "size": "",
    "uuid": "",
    "@type": "",
    "@context": "",
    "assignee": "",
    "filename": "",
    "metadata": {
        "md5": "",
        "sha1": "",
        "sha256": ""
    },
    "mimeType": "",
    "thumbnail": "",
    "uploadDate": ""
}

operation: Run Command

Input parameters

Parameter Description
Command Specify the command to execute remotely on the Windows machine.

Output

The output contains the following populated JSON schema:

{
    "op_result": "",
    "op_status": ""
}

operation: Run Powershell Command

Input parameters

Parameter Description
Command Specify the command to execute remotely on the Windows machine's PowerShell.
Convert to JSON (Optional) Select this option to convert the command output to the JSON format. By default, this is selected, i.e., set to True.

Output

The output contains the following populated JSON schema:

{
    "op_result": "",
    "op_status": ""
}

operation: Run Inline Powershell Script

Input parameters

Parameter Description
Powershell Script Specify the inline powershell script to execute on the specified endpoint

Output

The output contains the following populated JSON schema:

{
    "op_result": "",
    "op_status": ""
}

operation: Run Script

Input parameters

Parameter Description
Attachment IRI/ File IRI Specify the Attachment IRI or File IRI of the script file to submit files directly from the FortiSOAR™'s Attachments module to the Windows server.

Output

The output contains the following populated JSON schema:

{
    "op_result": "",
    "op_status": ""
}

operation: Upload File To Endpoint

Input parameters

Parameter Description
Absolute File Path Specify the filepath on the remote machine on which to upload the file.
Attachment IRI/ File IRI Specify the Attachment IRI or File IRI of the script file to upload files directly from the FortiSOAR™'s Attachments module to the Windows server.

Output

No output schema is available at this time.

Included playbooks

The Sample - Microsoft WinRM - 2.0.0 playbook collection comes bundled with the Microsoft WinRM connector. These playbooks contain steps using which you can perform all supported actions. You can see bundled playbooks in the Automation > Playbooks section in FortiSOAR™ after importing the Microsoft WinRM connector.

  • Get File
  • Run Command
  • Run Inline Powershell Script
  • Run Powershell Command
  • Run Script
  • Upload File To Endpoint

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.

Configuring WinRM on a Windows server

Configuring WinRM on a Windows server

To use this connector, you must configure WinRM on the Windows server to which you want to connect. To configure WinRM, do the following:

  1. Run the following command to set the default WinRM configuration values:
    c:\> winrm quickconfig
  2. (Optional) Run the following command to check whether a listener is running, and verify the default ports:
    c:\> winrm e winrm/config/listener
    The default ports are 5985 for HTTP, and 5986 for HTTPS.
  3. Enable basic authentication on the WinRM service.
    1. Run the following command to check whether basic authentication is allowed.

      c:\> winrm get winrm/config/service

    2. Run the following command to enable basic authentication.
      c:\> winrm set winrm/config/service/auth @{Basic="true"}

  4. Run the following command to allow transfer of unencrypted data on the WinRM service.

    c:\> winrm set winrm/config/service @{AllowUnencrypted="true"}

  5. 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"}

  6. Enable basic authentication on the WinRM client.

    1. Run the following command to check whether basic authentication is allowed.

      c:\> winrm get winrm/config/client

    2. Run the following command to enable basic authentication.

      c:\> winrm set winrm/config/client/auth @{Basic="true"}

  7. Run the following command to allow the transfer of unencrypted data on the WinRM client.

    c:\> winrm set winrm/config/client @{AllowUnencrypted="true"}

  8. 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"}

  9. 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

Previous
Next

Microsoft WinRM v2.0.0

About the connector

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.

Version information

Connector Version: 2.0.0

FortiSOAR™ Version Tested on: 7.6.0-5012

Microsoft WinRM Version Tested on:

Authored By: Fortinet

Certified: Yes

Release Notes for version 2.0.0

Following enhancements have been made to the Microsoft WinRM connector in version 2.0.0:

Installing the connector

Use the Content Hub to install the connector. For the detailed procedure to install a connector, click here.

You can also use the yum command as a root user to install the connector:

yum install cyops-connector-microsoft-winrm

Prerequisites to configuring the connector

Minimum Permissions Required

Configuring the connector

For the procedure to configure a connector, click here

Configuration parameters

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
Protocol Select the protocol to use for the remote connection. You can choose from the following options:
  • http
  • https
Host Specify the IP address of the windows machine on which to execute the command.
Port Specify the port number to connect to the Windows server. Default port for http is 5985, and for https is 5986.
Authentication Type Specify the type for authentication. Authentication type can be basic, ntlm, or credssp.

NOTE: You may encounter an error when using NTLM authentication type. For resolution, refer to the community article Exchange/Microsoft WinRM Connector - Error: unsupported hash type md4.

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.
By default, this option is selected, i.e., set to true.

Actions supported by the connector

You can use the following automated operations in playbooks and also use the annotations to access operations:

Function Description Annotation and Category
Get File Gets a file from windows machine that you have specified. get_file
Miscellaneous
Run Command Runs the specified command on the configured Windows machine. execute_command
Miscellaneous
Run Powershell Command Executes the given Powershell command on the configured Windows machine. execute_command
Miscellaneous
Run Inline Powershell Script Execute a series of Powershell commands on multiple lines without saving the script as an Attachment record. execute_ps_script
Miscellaneous
Run Script Executes the script you specify on the configured Windows machine. execute_command
Miscellaneous
Upload File To Endpoint Uploads the specified file to the specified remote location on the Windows machine. upload_file_to_endpoint
Miscellaneous

operation: Get File

Input parameters

Parameter Description
Absolute File Path Specify the filepath on the remote machine from which to fetch the file.
Create Attachment (Optional) Select to create the file as an attachment in FortiSOAR's Attachments module. By default, this option is selected, i.e. set to True. Clear this checkbox to create the copied file as a file record.

Output

The output contains the following populated JSON schema:

Output schema when you choose "Create Attachment" as "true":

{
    "id": "",
    "@id": "",
    "file": {
        "id": "",
        "@id": "",
        "size": "",
        "uuid": "",
        "@type": "",
        "assignee": "",
        "filename": "",
        "metadata": [],
        "mimeType": "",
        "thumbnail": "",
        "uploadDate": ""
    },
    "name": "",
    "type": "",
    "uuid": "",
    "@type": "",
    "tasks": [],
    "alerts": [],
    "assets": [],
    "owners": [],
    "people": [],
    "@context": "",
    "assignee": "",
    "comments": [],
    "warrooms": [],
    "incidents": [],
    "createDate": "",
    "createUser": {
        "id": "",
        "@id": "",
        "name": "",
        "uuid": "",
        "@type": "",
        "avatar": "",
        "userId": "",
        "userType": "",
        "createDate": "",
        "createUser": "",
        "modifyDate": "",
        "modifyUser": ""
    },
    "indicators": [],
    "modifyDate": "",
    "modifyUser": {
        "id": "",
        "@id": "",
        "name": "",
        "uuid": "",
        "@type": "",
        "avatar": "",
        "userId": "",
        "userType": "",
        "createDate": "",
        "createUser": "",
        "modifyDate": "",
        "modifyUser": ""
    },
    "recordTags": [],
    "userOwners": [],
    "workspaces": [],
    "description": ""
}

Output schema when you choose "Create Attachment" as "false":

{
    "id": "",
    "@id": "",
    "size": "",
    "uuid": "",
    "@type": "",
    "@context": "",
    "assignee": "",
    "filename": "",
    "metadata": {
        "md5": "",
        "sha1": "",
        "sha256": ""
    },
    "mimeType": "",
    "thumbnail": "",
    "uploadDate": ""
}

operation: Run Command

Input parameters

Parameter Description
Command Specify the command to execute remotely on the Windows machine.

Output

The output contains the following populated JSON schema:

{
    "op_result": "",
    "op_status": ""
}

operation: Run Powershell Command

Input parameters

Parameter Description
Command Specify the command to execute remotely on the Windows machine's PowerShell.
Convert to JSON (Optional) Select this option to convert the command output to the JSON format. By default, this is selected, i.e., set to True.

Output

The output contains the following populated JSON schema:

{
    "op_result": "",
    "op_status": ""
}

operation: Run Inline Powershell Script

Input parameters

Parameter Description
Powershell Script Specify the inline powershell script to execute on the specified endpoint

Output

The output contains the following populated JSON schema:

{
    "op_result": "",
    "op_status": ""
}

operation: Run Script

Input parameters

Parameter Description
Attachment IRI/ File IRI Specify the Attachment IRI or File IRI of the script file to submit files directly from the FortiSOAR™'s Attachments module to the Windows server.

Output

The output contains the following populated JSON schema:

{
    "op_result": "",
    "op_status": ""
}

operation: Upload File To Endpoint

Input parameters

Parameter Description
Absolute File Path Specify the filepath on the remote machine on which to upload the file.
Attachment IRI/ File IRI Specify the Attachment IRI or File IRI of the script file to upload files directly from the FortiSOAR™'s Attachments module to the Windows server.

Output

No output schema is available at this time.

Included playbooks

The Sample - Microsoft WinRM - 2.0.0 playbook collection comes bundled with the Microsoft WinRM connector. These playbooks contain steps using which you can perform all supported actions. You can see 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.

Configuring WinRM on a Windows server

Configuring WinRM on a Windows server

To use this connector, you must configure WinRM on the Windows server to which you want to connect. To configure WinRM, do the following:

  1. Run the following command to set the default WinRM configuration values:
    c:\> winrm quickconfig
  2. (Optional) Run the following command to check whether a listener is running, and verify the default ports:
    c:\> winrm e winrm/config/listener
    The default ports are 5985 for HTTP, and 5986 for HTTPS.
  3. Enable basic authentication on the WinRM service.
    1. Run the following command to check whether basic authentication is allowed.

      c:\> winrm get winrm/config/service

    2. Run the following command to enable basic authentication.
      c:\> winrm set winrm/config/service/auth @{Basic="true"}

  4. Run the following command to allow transfer of unencrypted data on the WinRM service.

    c:\> winrm set winrm/config/service @{AllowUnencrypted="true"}

  5. 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"}

  6. Enable basic authentication on the WinRM client.

    1. Run the following command to check whether basic authentication is allowed.

      c:\> winrm get winrm/config/client

    2. Run the following command to enable basic authentication.

      c:\> winrm set winrm/config/client/auth @{Basic="true"}

  7. Run the following command to allow the transfer of unencrypted data on the WinRM client.

    c:\> winrm set winrm/config/client @{AllowUnencrypted="true"}

  8. 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"}

  9. 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

Previous
Next