Example PowerShell Script - EcoSys - Training - Hexagon PPM

Integrating EcoSys API with PowerShell Tutorial

PPMProductFamily
Other
PPMProduct
EcoSys
PPMCategory
Training
Version_EcoSys
8.6

# Create credentials

$username = "admin"

$password = "secret"

$secstr = New-Object -TypeName System.Security.SecureString

$password.ToCharArray() | ForEach-Object {$secstr.AppendChar($_)}

$cred = new-object -typename System.Management.Automation.PSCredential -argumentlist $username, $secstr

# Create web service, provide wsdl & credentials   

$proxy = New-WebServiceProxy -uri http://myserver:8080/ecosys/api/wsdl11/SampleAPI/SampleAPI.wsdl -Namespace ns -Credential $cred

# Create Options (and parameters if needed)

$cfo = New-Object ns. SampleAPI

$cfo.Username = "admin"

$cfo.Password = "secret"

# Create any needed request object, here is read

$req = New-Object ns. SampleAPI

# Make request call

$proxy.ReadSampleAPI($req)