SupportDesk PowerShell

SupportDesk can execute a Windows PowerShell script when a specific category on a call is selected.

The PowerShell script executes in the background on the client machine running the SupportDesk Windows application, or on the IIS server running the SupportDesk WebServer.

The PowerShell scripts you write and the Windows PowerShell environment are unsupported by House on the Hill Software. It is up to you to test and validate that scripts work as you intend in your network environment. SupportDesk is simply a launch platform. We have very limited experience of writing PowerShell scripts for a production environment.

To create a PowerShell script within SupportDesk, click on System Management/PowerShell Scripts then on the New button on the ribbon bar.

This will create a PowerShell script with some sample code:

powershell script

The first (comment) line of the script names the script – this one is called PowerShell.

Click on the Test button to debug the script. This will start the Windows PowerShell ISE with the script loaded and some additional header and trailer lines for housekeeping.

powershell ise

The script from the SupportDesk database has been temporarily written to the file – c:\temp\HhsPsTemp\TEST-Super.ps1. It is this file that the ISE will execute. Any changes to the code within the ISE will not be reflected in the original script in the SupportDesk database.

The first line starts a transcript file that captures information about the running script. This can be useful when the script runs in the background outside the ISE.

The last line deletes the temporary script file that was created from the SupportDesk database to pass to the ISE.

After setting a breakpoint on line 6 and running the script, the lower pane shows the output of the Write-Output statement then stops.

write-output statement

You may need to enter the command ‘set-executionpolicy remotesigned’ into the lower ISE pane if the Windows script execution policy prevents the script from running.

The transcript file also shows this:

transcript file

SupportDesk can trigger a PowerShell script on change of category e.g. Status.

Select the PowerShell script that should be run in the category details – Run PowerShell Script.

status details

When this category is selected on a call, the selected PowerShell script will be run.

Fields from the call can be included in the script using the same syntax used in email templates e.g. <call:customer>.

Checking the ‘Debug scripts on category change’ checkbox in the PowerShell script window will cause the Windows PowerShell ISE to start when a category change in the SupportDesk Windows client triggers a PowerShell script.

Below is a very simple example showing a script that successfully added a new Active Directory user to a test domain.

It uses the <System:Ldap…> replacements to pass the AD server name, login and password from the LDAP sync settings.

Call extra fields NewUserName and NewUserPassword were used on a form to capture the new user’s credentials.

new user

PreviousNext