PowerShell Task Engine state in Circuit | Qntrl | Circuit | Online Help

PowerShell Task Engine

These states are used to perform any actions in the Windows machines of a private network using PowerShell commands.

 

There are six states available in the PowerShell Task Engine for performing different operations.

  • PowerShell Engine

  • Install WindowsApp

  • Uninstall WindowsApp

  • Start Service

  • Stop Service

  • Restart WindowsServer

Almost all the operations can be performed using the PowerShell Engine state, but to facilitate reusability, some frequently used operations are provided as separate states.

Prerequisite
  • An active Bridge agent. Refer here to install and configure Bridge.

  • Create necessary Credentials for the applications to be connected by PowerShell Task Engine.

For more details about the PowerShell Engine module in Bridge, the keys, and its description click here.

Example Use Case: During the asset allocation process, the installation of the Windows OS for employees can be carried out through the PowerShell Engine state. Using PowerShell Engine, the system administrator can establish a connection with the employee's machine and execute remote commands to install OS, and other software and to start/stop services.

Let us see how to configure various PowerShell Task Engine states in Builder View and Code View.

PowerShell Engine

Executes an attached PowerShell script file on the Windows machine in a private network.

For associating the state to a circuit in Builder View:
  1. Drag and drop the required PowerShell Engine state from the left pane into your circuit or click the required state in your circuit.

  2. Under Configuration, update the common state field attributes.

  3. In Bridge ID, click and select the Bridge to be configured to the state from the drop-down list.

  4. Under the Add Configuration section, fill in the following fields:

    • Credential ID - Select the credential from the dropdown list. The Credential ID of all the credentials created for the SSH module type will be displayed in the list.

    • Script ID - Select the name of the Script to be executed. To create a new script file, navigate to Scripts.

    • Host - Enter the hostname of the machine in which the shell command has to be executed. Enter the hostname as localhost, if the shell command is executed on the same Bridge-installed machine.

  5. Under the Variable section, click Add. The field will expand and allow you to add variables that need to be executed in the PowerShell script. Enter a variable name and its param value.

  6. Under the Add Credentials section, click Add to enter the credentials of any Windows machine that has to be connected through the PowerShell script.

    1. Var name - Provide a name for the credential.

    2. Name - Select the credential name from the dropdown list that needs to be connected through the PowerShell script.

    To remove an added Variable or Credential, hover over the line below the fields and click Remove.
 
    

  In Code View, the JSON to execute a PowerShell command and perform a PowerShell task in Circuit is given below:

"Windows OS Installation": {
"type": "powershell_engine",
"next": "Licence Key Activation-Windows",
"start": true,
"bridge_id": "Bridge_1368_1",
"payload": {
            "credential_id": "PWSH Credential for OS installation",
            "script_id": "Script-OSinstall",
            "host": "localhost",
            "variables": {
  "os_filename": "windows.iso"
            },
            "credentials": [
  {
  "variable": "Windows_SK01",
"credential_id": "psh_cred_5"
  }
  ]
 }
}

Install WindowsApp  

This state allows users to install apps in Windows machines using PowerShell.

This state can be configured in Builder View by entering the MSI file location of the app to be installed in the MSI Filepath field under the Add Configuration section in addition to the common field attributes.

 

In Code View, the JSON to install a Windows app using PowerShell task in circuit is given below:

"Install an Application": {
      "type": "install_windows_app",
      "next": "End",
      "start": true",
      "bridge_id": "bridge-employee onboarding",
      "payload": {
            "credential_id": "PWSH Credential for OS installation",
            "host": "localhost",
            "msi_file_path":"C:\\Users\\Administrator\\Downloads\\tortoisehg-5.8.0-x64.msi"
      }
}

Uninstall WindowsApp  

An existing app can be uninstalled from the Windows machine using this state.

To uninstall an app from the Windows machine, in Builder View, fill in the common state field attributes. Under Add Configuration, in App Name, enter the name of the app to be uninstalled from the Windows machine.      

In Code View, the JSON to uninstall a Windows app using a PowerShell task in Circuit is given below:

"Uninstall Windows App": {
      "type": "uninstall_windows_app",
      "next": "End",
      "start": true,
      "bridge_id": "<bridge_name>",
      "payload": {
            "credential_id": "<credential_name>",
            "host": "<host_name>",
            "app_name": "<application_name>"
      }
}

Start Service  

This state helps to start a service in the backend Windows server.
To configure a Start Service in Builder View, fill in the common field attributes, and under Add Configuration, in Service Name, enter the name of the service that has to be initiated in a Windows machine. 


 
In Code View, the following JSON is used to start a service using the PowerShell engine task in Circuit:

"Start App Management Service": {
"type": "start_service",
"next": "End",
"start": true,
"bridge_id": "bridge-1368_1",
"payload": {
"credential_id": "pwsh_cred_5",
"host": "localhost",
"service_name": "AppMgmt"
}
}

Stop Service  

A service running in the backend Windows server can be stopped with this state.

To configure the Stop Service state in Builder View, fill in the common state field attributes. Under Add Configuration, in the Service Name field, enter the name of the service that has to be stopped on the Windows machine.

In Code View, the following JSON is used to stop a service using the PowerShell engine task in circuit:
"Stop a Service": {
"type": "stop_service",
"next": "End",
"start": true,
"bridge_id": "<bridge_name>",
"payload": {
"credential_id": "<credential_name>",
"host": "<host_name>",
"service_name": "<service_name>"
}
}
  

Restart Windows Server  

This state is used to restart the Windows server operating system, which stops all running processes and services on the server, followed by a complete system reboot. It is often done to apply system updates, resolve issues, or perform routine maintenance tasks.

To configure the state in Builder View, under Add Configuration, select the Credential ID and enter the Host name of the Windows machine that has to be restarted.

In Code View, the following JSON is used to restart a Windows server:

"Restart WindowsW10": {
"type": "restart_windows_server",
"next": "End",
"start": true,
"bridge_id": "<bridge_name>",
"payload": {
"credential_id": "<credential_name>",
"host": "host_name>"
}
}





NextAD Task

    • Related Articles

    • PowerShell Engine

      PowerShell Engine In Bridge, the PowerShell Engine module is used to perform actions in any Windows machines in the client's network using PowerShell script. Prerequisite While creating Credentials, select the type Powershell and provide the User ...
    • Task Engine

      In Qntrl, while public APIs can be configured and executed directly through Webhooks, the client's internal APIs that are exposed only to the local network can be executed using the Task Engine module in Bridge. The Task Engine configured in Bridge ...
    • Task Engine

      Circuit's Task Engine state is used to connect with other applications and access APIs from a closed space. To retrieve data from a private network, the required API must be accessed from the local machine's network for the required conditions. ...
    • SSH Engine

      SSH Engine state is configured to connect to a client's machine or network and remotely execute commands or scripts on the client's Linux/UNIX operating system. Prerequisite Bridge must be installed and should be active. Learn how to install and ...
    • SSH Engine

      SSH Engine module in Bridge is used to perform actions in the client network/client's machine by executing a command/script in Linux/UNIX OS. Prerequisite While creating credentials for SSH Engine, choose the Credential type as SSH. Click here to ...

    You are currently viewing the help articles of Qntrl 3.0. If you are still using our older version and require guidance with it, Click here.