Creating and running actions

In the left pane of asset and user pages in Lansweeper, actions are listed. Actions are administrative and other tasks you can perform on the asset or user whose page you're viewing. They allow you to do things like open the webpage of an asset that has HTTP or HTTPS enabled, open the administrative shares on a Windows computer, set up a remote desktop session, reboot a Windows computer, reset the password of an Active Directory user etc. To accomplish these tasks, the actions use underlying CMD commands, scripts and executables, which are stored in a folder on the Lansweeper server. There are built-in actions, but you can create your own as well. The below steps provide general instructions for creating and then running actions.

asset and user actions

Step 1: find the command or tool required for the action you want to perform

An action runs a CMD command, a script or an executable specified by you. To create a Lansweeper action that performs a specific task related to an asset or user, first locate the command or tool you can use to perform this task. You can use a built-in Windows tool or command or integrate a third-party tool with Lansweeper.

In selecting a command or tool, keep in mind that it must run successfully from a Windows computer. Also keep in mind that the underlying command of a Lansweeper action is run on the machine you're accessing the web console from. An action is different from a deployment package in that sense. When you run a deployment on a Windows computer, the underlying command of the deployment is run locally on the client machine you're targeting with the deployment. When you run an action, however, the underlying command is not run locally on the targeted client machine. Instead, it is run on the machine you're accessing the web console from. It's the underlying command or tool of the action that must support performing a task related to the targeted client machine.

This action is built-in, but let's say you wanted to create an action to set up an SSH session to a client machine. You want to be able to open the Lansweeper web console on machine A and then set up an SSH session to machine B from machine B's Lansweeper webpage. To do this, you would first research the commands or tools you can use to accomplish this. You'll know or find in your research that PuTTY is one tool that can accomplish the task of setting up an SSH session remotely. You download the putty.exe tool and first test its SSH functionally outside of Lansweeper, in Command Prompt. Within Lansweeper, you'll be able to replace any specific mentions of client machine IP addresses in the action command with a parameter. That way, Lansweeper will automatically execute the PuTTY command for the client machine whose webpage you're viewing.

Step 2: add your action files to the Lansweeper folder

Once you've selected a tool or command for your action and tested it in Command Prompt, add the tool or any files required by it to the Program Files (x86)\Lansweeper\Actions folder on your Lansweeper server. By default, this folder is shared as lansweeper$.

  • If your action is just a CMD command that doesn't call any scripts or executables, you don't need to add anything to the lansweeper$ folder.
  • If your action references a built-in Windows tool that can be found under C:\Windows\System32 on Windows computers, you don't need to add anything to the lansweeper$ folder. When you add the action to the Lansweeper web console, you can just start the action with the name of the tool. Lansweeper will automatically try to locate the tool under C:\Windows\System32 when the action is run.
  • If your action references a third-party executable, tool or script, add it to the lansweeper$ folder on your Lansweeper server.

Step 3: add your action to the Lansweeper web console

Once you've added your action files to the Lansweeper folder, you can add your action to the Lansweeper web console. Asset actions can be added in the Configuration\Asset Pages section of the web console. User actions can be added in the Configuration\User Pages section of the web console. Keep in mind that user actions can only be run on domain users, not local users.

creating asset and user actions

Available settings

When submitting an action in the web console, the following settings are available:

  • Description: The name of the action as you want it to appear on asset or user pages.
  • Action: The underlying command of the action. If your action references a third-party executable, tool or script, make sure to start the action command in Lansweeper with the {actionpath} parameter.
  • Icon: The icon that accompanies the action on asset or user pages. There are built-in icons but you can also add your own to the Program Files (x86)\Lansweeper\Actions folder on your Lansweeper server.
  • Sort order: The order in which the action is displayed among other actions on asset or user pages. A lower number means the action is listed more towards the top of the list.
  • Enabled: If checked, the action is listed and available for use on asset or user pages. If unchecked, the action is not listed on asset or user pages.
  • Ask for confirmation: If checked and a user runs the specified action, a confirmation popup is presented. Only when the user confirms in the popup is the action executed.
  • Advanced action: If checked, the action is listed in the Advanced Actions section on asset or user pages. If unchecked, the action is listed in the Basic Actions section.
  • Render as Hyperlink: If checked, the action is treated as a hyperlink. Only check this option if your asset or user action is in fact a URL.

Available parameters

The below parameters are available for use in asset action commands:

  • {actionpath} This is the Action Path folder specified under Configuration\Asset Pages in the web console. By default, this parameter refers to the lansweeper$ shared folder on your Lansweeper server, which is automatically generated by the Lansweeper installer. If you want to use your own shared folder to store actions, you can submit it as your Action Path.
  • {smartname} This is replaced with the asset's NetBIOS name, FQDN or IP address, depending on the asset type.
  • {assetname} The (NetBIOS) name of the asset. This parameter can be used for any asset type.
  • {dnsname} The DNS name of the asset.
  • {computer} The NetBIOS name of the asset. This parameter only works for Windows computers.
  • {domain} The NetBIOS domain name of the asset.
  • {tag} The serial number of the asset.
  • {username} The name of the last logged on user of a Windows computer.
  • {userdomain} The NetBIOS domain name of the last logged on user of a Windows computer.
  • {ipaddress} The IPv4 address of the asset.
  • {fqdn} The FQDN (Fully Qualified Domain Name) of the asset.
  • {scanserver} The name of the last scanning server to scan the asset.
  • {assetid} The database ID of the asset. Every asset gets a sequential, numeric ID when it's added to the Lansweeper database.
  • {mac} The MAC address of the asset. For devices with multiple MAC addresses, this is the MAC address listed at the top of the asset page.

The following parameters are available for use in user action commands:

  • {actionpath} This is the Action Path folder specified under Configuration\Asset Pages in the web console. By default, this parameter refers to the lansweeper$ shared folder on your Lansweeper server, which is automatically generated by the Lansweeper installer. If you want to use your own shared folder to store actions, you can submit it as your Action Path.
  • {username} The name of the Active Directory user.
  • {userdomain} The NetBIOS domain name of the Active Directory user.
  • {displayname} The display name of the user as specified in Active Directory.
  • {telephone} The telephone number of the user as specified in Active Directory.
  • {fax} The fax number of the user as specified in Active Directory.
  • {mobile} The mobile phone number of the user as specified in Active Directory.
  • {email} The email address of the user as specified in Active Directory.
  • {ou} The OU (Organizational Unit) the user resides in in Active Directory.
  • {cn} The path of the user in Active Directory, e.g. cn=John Doe, cn=users, dc=mydomain, dc=local.

Step 4: grant users the right to run actions

Make sure you grant the appropriate users the right to run asset and user actions. There are two permissions for running actions, one for running basic actions and one for running advanced actions. As stated before in this article, you can configure which actions are basic and which are advanced. Info on setting up permissions in the web console can be found in this knowledge base article.

Step 5: configure your web browser to run actions

In order to run asset or user actions, your web browser must be properly configured. Officially supported web browsers are Internet Explorer, Firefox and Chrome. Configuration instructions for these browsers can be found in the knowledge base.

  • Configuration instructions for Internet Explorer can be found in this article.
  • Configuration instructions for Mozilla Firefox can be found in this article.
  • Configuration instructions for Google Chrome can be found in this article.

Step 6: run the action

Once you've set up the action and configured your browser, you can start running the action. Browse to the Lansweeper webpage of the asset or user you want to run the action on. You can then click the action on the left side of the page.

Related Articles