Disclaimer: The following code provided below is just an example and might need to be re-written to meet your expectation in your environment.
You will find here how to call QMS API using PowerShell with some examples. Please note that there are some requirements to use the QlikView Management Service API. For more detail see QlikView Management Service API
First of all the IQMS interface is deprecated in QlikView 12 and IQMS2 should be used instead. For example, using IQMS in QlikView 11: http://ws.qliktech.com/QMS/ 11/IQMS/GetTimeLimitedServiceKey But in QlikView 12, this should be: http://ws.qliktech.com/QMS/ 12/IQMS/GetTimeLimitedServiceKey
Using IQMS2 in QlikView 12 will look like: http://ws.qliktech.com/QMS/ 12/2/IQMS2/GetTimeLimitedServiceKey
Differences between IQMS and IQMS2 There are some differences in the intended use of the QMS API between QlikView 11.20 and QlikView 12.10. For these reasons, a new QMS API interface was introduced with QlikView 12.10, IQMS2, while the QMS API interface used for QlikView 11.20 is available as IQMS. This ensures that customers who have built their clients for QlikView 11.20 can use them with no modifications when upgrading to QlikView 12.10 or later. IQMS2 have a number of additional methods that are not available in IQMS. If you want to create a new API client on QlikView 12.10 or later, you are recommended to use IQMS2 because of the extra functionality it offers. If you downgrade to QlikView 11.20 while your API client is utilizing the IQMS2 namespace, you must change to the IQMS interface and remove all references to IQMS2 methods that are not available in IQMS. Reference: QlikView Management Service API
Qlikview Server 11.20 or higher
First of all before performing a call, you need to get a Service Key. This is used for most of API calls towards the QMS API.
## URL for the QMS API endpoint
$url = "http://servername:4799/QMS/Service"
$service = New-WebServiceProxy -Uri $url -Namespace QlikViewServer -UseDefaultCredential
$serviceKey = $service.GetTimeLimitedServiceKey()
In return you will get a temporary Service Key which will expired 60 seconds after it was generated.
Now that you have the Service Key, you can reuse it perform API calls against the QMS API. Below is an example of a script to run a task