Jump to content

PowerCLI/PowerShell Module


Dan White
Go to solution Solved by Dan White,

Recommended Posts

In the on-premises version of Horizon, we have the luxury of having the PowerCLI module to automate the infrastructure. This was particularly helpful when you have to publish dozens of manual applications.

Is there anyway to extend this functionality to the cloud version? The current PowerCLI connections require a connection server, which we don't have in the cloud version. Is there a fast way to publish and assign 50ish manual applications quickly?

Thx,

Dan

  • Like 1
Link to comment
Share on other sites

  • Solution

Hopefully this will help someone in the future. I found this article that had an example of how to access the REST API from PowerShell:

https://techzone.omnissa.com/blog/getting-started-horizon-cloud-service-next-gen-supported-rest-apis-powershell

Here is a basic script that I have that will return information on the pools:

 

#Authenticate
$Url = "https://connect.omnissa.com/csp/gateway/am/api/auth/api-tokens/authorize"
$APIToken = "YOUR API TOKEN HERE" #Expires every 6 months
$params = @{refresh_token = $APIToken}
$Connection = Invoke-WebRequest $url -Method Post -Body $params -UseBasicParsing | ConvertFrom-Json
$Token = $Connection.access_token

#Setup Headers
$Headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$Headers.Add("Authorization", "Bearer $Token")
$Headers.Add("Accept","application/json, text/plain, */*")

#Get Pool Data
$Url = "https://cloud.vmwarehorizon.com/portal/v2/pools"
$Pools = Invoke-WebRequest $url -Method Get -Headers $Headers -UseBasicParsing | ConvertFrom-Json
$pools.content | Select name,DisplayName,Type

It's disappointing that the code insertion feature of this forum doesn't support PowerShell 😞

As stated above, here is the link to the full REST API documentation:

https://developer.omnissa.com/horizon/apis/horizon-cloud-nextgen/#api

Hope that helps

  • Like 2
Link to comment
Share on other sites

  • 2 months later...

It appears that this document is outdated:
https://techzone.omnissa.com/blog/getting-started-horizon-cloud-service-next-gen-supported-rest-apis-powershell

and this API list does not exist anymore:
https://developer.omnissa.com/horizon/apis/horizon-cloud-nextgen/#api

Can someone from Omnissa point me in the right direction? My end goal is to be able to publish manual applications via powershell.

 

Thx,
Dan

Link to comment
Share on other sites

Hi Dan,

Here is the link to the Horizon Cloud REST API page: https://developer.omnissa.com/horizon-apis/horizon-cloud-nextgen/

 

Sean Massey
Independent Consultant/Analyst/Blogger | VCDX-EUC 247
Vice Chairman of the Board - World of EUC
Blog: thevirtualhorizon.com  Mastodon: @seanpmassey@vmst.io Instagram/Thread:
@seanpmassey LI: https://www.linkedin.com/in/seanpmassey/

Link to comment
Share on other sites

2 minutes ago, Dan White said:

Hi Sean, 

I appreciate the response but that site doesn't have the actual API documentation of which Methods are available and how to use them.

I see them when I scroll down that page I linked above.

image.thumb.png.8b3b61be382538bda0dc12792b180539.png

Sean Massey
Independent Consultant/Analyst/Blogger | VCDX-EUC 247
Vice Chairman of the Board - World of EUC
Blog: thevirtualhorizon.com  Mastodon: @seanpmassey@vmst.io Instagram/Thread:
@seanpmassey LI: https://www.linkedin.com/in/seanpmassey/

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...