citrix gotoprovisioningapi powershell integration · pdf filecitrix gotoprovisioningapi...

Click here to load reader

Post on 04-Jul-2019

226 views

Category:

Documents

0 download

Embed Size (px)

TRANSCRIPT

  • Citrix GotoProvisioningAPI PowerShell integration

    This sample illustrates GoTo Products Provisioning API integration with C# in .Net projects. It also

    shows how to use the PowerShell to manage your GoTo Products GoToMeeting, GoToWebinar,

    GoToTraining and OpenVoice.

    The first part of this document explains how to use the ready compiled cmdLet in a Win7 PowerShell

    3 environment for some typical tasks.

    The second part explains how to compile and modify the PowerShell cmdLet.

    Using the CitrixGotoUserAPI CmdLet ...................................................................................................... 2

    PowerShell ........................................................................................................................................... 2

    Load the module.................................................................................................................................. 2

    First try ................................................................................................................................................ 4

    Command reference for the CitrixGotoUserAPI CmdLet ........................................................................ 5

    Data Objects ........................................................................................................................................ 5

    GotoUserProvisioningAPI connection object .................................................................................. 5

    GotoUser data object ..................................................................................................................... 5

    GotoUserList list object ................................................................................................................... 6

    Commands ........................................................................................................................................... 6

    Platforms ......................................................................................................................................... 6

    Initiate API Connection .................................................................................................................... 7

    Get List of Users............................................................................................................................... 7

    Get/Create/Delete Users ................................................................................................................. 7

    Set user properties and user state ............................................................................................. 7

    Modify the Licenses of user (not supported on Classic platform) .............................................. 7

    User list filter commands ................................................................................................................ 7

    Filtered by enumerations of GotoUser object: ........................................................................... 8

    Filtered by text properties: .......................................................................................................... 8

    Filtered by numeric properties: ................................................................................................... 8

    Special user list commands: ........................................................................................................ 8

    A tour through user provisioning ............................................................................................................ 8

    Prerequisites ........................................................................................................................................ 8

    Get the list and extract the interesting users ...................................................................................... 9

    Suspend all users of a list .............................................................................................................. 10

  • Change properties and licenses of user ........................................................................................ 10

    Delete a user.................................................................................................................................. 11

    Create a user ................................................................................................................................. 11

    The CitrixGotoUserAPI CmdLet source .................................................................................................. 12

    Structure of project ........................................................................................................................... 12

    Using the CitrixGotoUserAPI CmdLet

    PowerShell The easiest way to start with PowerShell is to use the PowerShell Integrated Scripting Environment

    (ISE). Select start menu type power and start the PowerShell ISE.

    The shell contains the Shell, an editor and a list of loaded cmdLets.

    Load the module In the shell, navigate into the directory with the cmdLet AND the supporting JSON dll inside, i.e.

    c:\tmp .

    PS V:\> cd C:\Tmp

  • Import the CitrixGotoUserAPI.dll with the command import-module .\CitrixGotoUserAPI.dll

    PS C:\Tmp> import-Module .\CitrixGotoUserAPI.dll

    After this the cmdLet should be available. If you press the Refresh button on commands tab, then

    select the module CitrixGotoUserAPI, you should see the commands associated with that module.

  • or

    First try Now lets give the new commands a try. Try to login to API with the command Get-

    CitrixGoToUserAPI. The easiest way to do this is to use the trial possibility of commands tab.

    Select the command, enter your GoToMeeting admin account user, your password and press Run

    button. If you prefer to type the commands, you will be glad to know that ISE has a great auto

    completion.

    After this you should see the resulting Connection Object properties.

    Now lets query for your user properties:

  • $Connection = Get-CitrixGoToUserAPI -AdminUser YourAdminUser -Password YourPassword

    You need the connection Object for each command that gets or modifies data on API.

    Get-UserByMail $Connection $Connection.Configuration.User

    Get the user object for your own user. ($Connection.Configuration.User contains your email address.)

    Command reference for the CitrixGotoUserAPI CmdLet

    Data Objects The CitrixGotoUserAPI CmdLet brings 3 data objects.

    GotoUserProvisioningAPI connection object

    The connection object contains all the information required to use the Provisioning API.

    AccessToken : 7su2*******************GnEnX Platform : GLOBAL IsLegacyPlatform : False User : Password : * Url : https://api.citrixonline.com Configuration : CitrixGotoUserAPI.RestConfiguration ProxyConfiguration : IsConnected : True

    GotoUser data object

    This object contains all the user properties returned from API. In addition it has 3 local properties.

    1. ID is a read-only wrapper for organizerkey .

    2. Products - a list of product names (as strings) for JSON compatibility. The setter initializes

    the ProductList and LicencseList properties

    3. ProductList a list of product names (as enum values)

    4. LicenseList a list of licenses (as enum values)

    ID : 5758378037920123398 products : {G2W, G2M} organizerkey : 5758378037920123398 groupkey : 0 email : test_rh0549.s_name0549@hh.zz firstname : s_name0549 lastname : Test_RH0549 groupname : Testgruppe1 status : active maxnumattendeesallowed : 26 ProductList : {G2W, G2M} LicenseList : {G2W}

  • GotoUserList list object

    The .ToString() function of the object offers compact presentation of users in the list. The list object

    supports some filter functions, used by the Get-Filtered commands.

    PS C:\tmp> Write-Host $G2TUsers User: 1918303991098535429 -> test_rh0464.s_name0464@hh.zz (Test_RH0464, s_name0464) [G2T,G2W,G2M] State:active User: 1893638648912893 6197 -> rhahner_ln0009.fn0009@jedix.com (FN0009, LN0009) [G2T,G2W,G2M] State:active User: 2872692178635714310 -> test_rh1123.s_name11 23@hh.zz (Test_RH1123, s_name1123) [G2T,G2W,G2M,OPENVOICE] State:active PS C:\tmp> $G2TUsers ID : 1918303991098535429 products : {G2T, G2W, G2M} organizerkey : 1918303991098535429 groupkey : 0 email : test_rh0464.s_name0464@hh.zz firstname : s_name0464 lastname : Test_RH0464 groupname : Testgruppe1 status : active maxnumattendeesallowed : 26 ProductList : {G2T, G2W, G2M} LicenseList : {G2T, G2W} 6 Additional user listings ID : 2872692178635714310 products : {G2T, G2W, G2M, OPENVOICE} organizerkey : 2872692178635714310 groupkey : 0 email : test_rh1123.s_name1123@hh.zz firstname : s_name1123 lastname : Test_RH1123 groupname : Testgruppe1 status : active maxnumattendeesallowed : 26 ProductList : {G2T, G2W, G2M, OPENVOICE} LicenseList : {G2T, G2W, OPENVOICE} PS C:\tmp> $G2TUsers.ToString() User: 1918303991098535429 -> test_rh0464.s_name0464@hh.zz (Test_R

View more