|Applies To||RSA Product Set: Archer|
RSA Version/Condition: All
Platform: Windows PowerShell
|Resolution||Windows PowerShell makes it easy to use the Archer Web Services API when compared to tools like Visual Studio. Depending on the PowerShell version, it will include common functions, or cmdlets, to perform an action and return a Microsoft.NET object to process further. For more details, check out the Task-Based Guide to PowerShell Cmdlets.|
PowerShell 4.0 (Windows Management Framework 4.0) includes cmdlets for REST and Web Service API calls that simplify these tasks and process the results. This article focuses on the Web Services API. PowerShell 4.0 or higher needs to be installed on the computer running the scripts.
Download Windows Management Framework 4.0 here. NOTE: PowerShell 4.0 can be installed on an Archer Admin's workstation and does not have to be installed on the Archer servers.
After installing PowerShell 4.0 or higher, open the attached script in the Windows PowerShell ISE application. At the top of the script, update the Archer Instance variables for Base URL, Instance Name, User Domain, User Name, and Password. NOTE: Instance Name is case sensitive.
To login and create a session token, the following code snippet saves the session token to a variable. The User Domain will determine which Web Service method to call.
For any other API calls, the session token is required. The attached PowerShell script contains sample code using the following Web Service methods: CreateUserSessionFromInstance, CreateDomainUserSessionFromInstance, and ExecuteSearch. Depending on the Archer version, some methods may not be available. Please download the Web Services API Guide.
The following code snippet performs a very basic search and pages through the results.
For more examples of <SearchReport> for the ExecuteSearch method, check out KB 32489: How to search for records using the RSA Archer Web Services API method called ExecuteSearch.
Some of the code snippets in the attached script are commented out using the pound symbol (#) for a single line or comment blocks using <# ... #>. Deleting the "<" after the section's description will uncomment the whole block for testing.
NOTE: Some sections contain variables that rely on previous sections.