-
Notifications
You must be signed in to change notification settings - Fork 0
Powershell Sample
writeameer edited this page Sep 14, 2010
·
5 revisions
(Growing list of PowerShell samples in source )
Load the NRightAPI.dll assembly from the current working directory:
[Reflection.Assembly]::LoadFile((Get-Location).Path + “\NRightAPI.dll”)
- Instantiate NRightAPI using RS Accout number
$api = new-object RightClient.NRightAPI($account)
Use the Login() method to authenticate against RightScale. This will create a session cookie that will be used in subsequent REST requests to RightScale:
$api.Login($username,$password)
As an example, retrieve all your RightScripts in your account using the “right_scripts.xml” REST resource:
$response = $api.GetRequest(“right_scripts.xml”,$null)
The RightScripts are received as part of the HTTP response body. Output the rightscripts from the HTTP response using the DisplayRestResponse() method:
[RightClient.NRightAPI]::DisplayRestResponse($response)