Introduction

The API allows development of code to run against the ManagementStudio platform. This could take the form of external scripts running on disparate systems or code that runs within ManagementStudio to create new custom functions or events.


Downloading the API



  • Click the button 'Looking for the ManagementStudio SDK?'


  • Enter a ManagementStudio username and password at this point, then click Log in.
  • Once authenticated it will display the same page again and it this point click "Looking for the ManagementStudio SDK?" once again.
  • Click Download ManagementStudio PowerShell SDK.

  • It is very important to follow the instructions on the screen as later versions may contain different information to this document. A graphic on that screen will guide in unblocking the Zip file - this is a key step.
  • If updating an existing ManagementStudio Api then you must delete the existing 'ManagementStudioApi' folder that was created from the previous install and replace it with this one.
  • The ManagementStudio Api is delivered as a zip file, it is important that the zip be 'Unblocked' before it is unziped. Otherwise Windows will block the PowerShell module files inside the zip and Api calls will fail.


  • Extract the Zip file to a new folder, i.e. C:\MigrationStudioAPI


  • From that folder load the file called     APIStarerGeneric.ps1  into you favourite PowerShell editor. The best thing to do is save this file to another location and then save a copy with a different name to same location. This way you protect the original file and any related API files.


  • The file needs to be configured for the target environment. Look for the area tagged

 # The required Values are below - it should not work without them set.

  • The values are used to create an object called $ScriptArgs. 


Variable
Example
Purpose
LogsFolderc:\temp\logsWhere the log files should be written
Module 'Devices'What Module is the script looking at.
Items@(1000, 1001, 1002)Id's of the objects passed from the Server
ApiUrl'http://ManagementStudio.Domain.Local'URL to your ManagementStudio environment
AutomationFolder'C:\ManagementStudioAPI'Folder containing unzipped API files 
ProjectId'1'Which ManagementStudio Project
ScriptName'MyScriptName'Used to generate log files
UserName'DaveSmith'Username of an account in API Role Group
Password'DavesPassword'Password of the above username


Values can be recovered by calling $ScriptArgs.VariableName  i.e.

    $ScriptArgs.Module will return 'Devices' 

    $ScriptArgs.UserName will return 'DaveSmith'


These variables can be used in the scripts. i.e. Return the three machine objects defined in items.


            Get-MSModuleItems -Module $ScriptArgs.module -Ids $ScriptArgs.Items

            Get-MSModuleItems -Module $scriptArgs.Module -All