- Flexera Community
- :
- App Broker
- :
- App Broker Forum
- :
- How do you call the App Broker Web Service through PowerShell?
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How do you call the App Broker Web Service through PowerShell?
Many common tasks in App Broker can be performed by calling the Web Service API’s which are available. Common tasks include creating/configuring new catalog items, submitting/canceling requests, and approving/rejecting requests which require approval. The two main SOAP Web Services in App Broker are as follows:
http://[AppPortalServer]/ESD/API.asmx
http://[AppPortalServer]/ESD/ws/integration.asmx
Hitting either of these pages in a browser will show the API calls which are available, and also the input parameters for each.
While there are a number of ways to invoke the App Broker API calls, perhaps the most common is through the use of a PowerShell script. Fortunately, PowerShell makes this easy. The following is a very basic example of using PowerShell to create a new request for a catalog item:
$catalogID = 12
$targetDevice = "MyMachineName" $targetUser = "MyDomain\MyUserName" $requester = "MyDomain\MyRequesterName" $useApproval = $false $sendEmail = $false $uri = "http://sup-apfnmp-cw/esd/api.asmx" #Change to reflect App Broker server name. $WebService = New-WebServiceProxy -Uri $uri -UseDefaultCredential $requestID = $WebService.createRequest($catalogID, $targetDevice, $requester, $targetUser, $useApproval, $sendEmail, @()) echo $requestID
Note that in the above case, the switch -UseDefaultCredential indicates that the credentials for the user invoking the PowerShell script will be used to connect to the Web Service. If it is desirable to use a different account to connect to the Web Service, then the script could be modified as follows to use a specific account:
$catalogID = 12 $targetDevice = "MyMachineName" $targetUser = "MyDomain\MyUserName" $requester = "MyDomain\MyRequesterName" $useApproval = $false $sendEmail = $false $uri = "http://sup-apfnmp-cw/esd/api.asmx" #Change to reflect App Broker server name. $username = "MyDomain\MyAccountName" $password = "MyPassword" | ConvertTo-SecureString -AsPlainText -Force $cred = New-Object -typename System.Management.Automation.PSCredential -argumentlist $username, $password $WebService = New-WebServiceProxy -Uri $uri -Credential $cred $requestID = $WebService.createRequest($catalogID, $targetDevice, $requester, $targetUser, $useApproval, $sendEmail, @()) echo $requestID
Note: Before you can call the above Web Services, you must enable the API. This can be done by going to Settings -> Flexera Integration, and selecting "Enable App Portal API"
This thread has been automatically locked due to inactivity.
To continue the discussion, please start a new thread.
- Mark as New
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Or if you plan to run the script interactively and prefer to prompt for credentials for a "Run As"-like behavior instead of hard-coding alternate credentials into your script, you can leverage the Get-Credential commandlet.
