Skip to main content

Testing your EPM 11.1.2.4 workspace login with Powershell!

Here's a quick little script I wrote in Powershell to test the workspace login utilizing Powershells Invoke-WebRequest method. This does all the heaving lifting and all we have to do is pass into the Body parameter the sso_username and sso_password. Just run the script and supply the Foundation server and port. The user will be prompted for username and password. If login is successful the SSOToken is displayed. If not the error of the login problem is displayed.


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<#
 .SYNOPSIS
  Perform a Simple EPM Login Test
 
 .DESCRIPTION
  This script will perform a simple login test to EPM Workspace URL
 
 .PARAMETER FoundationServer
  The name of teh server where Foundation Services is running
 
 .PARAMETER port
  The port that Foundation services web service is listening on. Defaults to 19000
 
 .EXAMPLE
  PS C:\> .\Test-WorkspaceLogin.ps1 -FoundationServer 'Value1' -port 'Value2'
#>
[CmdletBinding()]
param
(
 [Parameter(Mandatory = $true)]
 [string]$FoundationServer,
 [Parameter(Mandatory = $false)]
 [string]$port = '19000'
)

$BaseUrl = ('http://{0}:{1}' -f $FoundationServer,$port)
$LoginUri = ('{0}/workspace/logon' -f $BaseUrl)
$Credentials = Get-Credential
$UserName = $Credentials.GetNetworkCredential().UserName
$Password = $Credentials.GetNetworkCredential().Password
$InitialBody = ('sso_username={0}&sso_password={1}' -f $UserName, $Password)

 try{

    $Response = Invoke-WebRequest -Uri $LoginUri -Method Post -Body $InitialBody -Verbose
 }
 catch {
 $_.Exception.Message
 exit
}

# Parse Response
$XmlContent = [xml]$Response.Content
$BpmResponse = $XmlContent.BpmResponse
# Determine type of Bpm Response
switch ($BpmResponse.type) {
 success {
  # Set SSOToken
  [string]$SSOToken = $BpmResponse.token.'#cdata-section'
  "$SSOToken"
 }
 error {
  # Throw an error
  throw $BpmResponse.desc.'#cdata-section'
 }
}

This script can be used in it's simplest form or you can expand on it and do so much more!


Comments

Popular posts from this blog

Bash function to check validation URLs

Here's a simple bash function that with the use of the 'curl' command can run some simple tests to see if your application is actually up and running. We know in the monitoring world of Hyperion it's not enough to just check the port. The java process could be bound and listening to a port but the Java webapp might not have initialized due to many possible reasons.

Remote Validation URL Check

So I decided today that I wanted to be able to check validation URLs much like the previous post I wrote Bash Check Validation URLs  but this time I didn't want to have to login to each EPM environment to do it. I simply wanted to open a terminal and run a command to check the validationContext URL's that are stored in the registry.html file. In order to do this

bash function to run MaxL scripts & error handling

Lately I've been working on creating a function in bash so that I can generically call MaxL scripts and process return codes from them so that I can do some error handling and possibly send a notification via email or SMS message depending on the situation. How the essbase_run_task function works is like this: