VMware Horizon Community
mrstorey303
Enthusiast
Enthusiast
Jump to solution

Automate creation of RDSH application pools with vmware.hv.helper

Hope there's some users of the new horizon powershell module out there - vmware.hv.helper - also got another active question in this this forum!

Does anyone have a method to automate the creation of RDSH application pools with powershell? 

I don't see a specific function in the helper module to deal with this specifically, but it's surely possible via the API?

Thanks.

1 Solution

Accepted Solutions
techguy129
Expert
Expert
Jump to solution

Here is the script I use to create application pools

connect-hvserver "connectionserverfqdn"

$ViewAPI = $global:DefaultHVServers[0].ExtensionData

#User Inputs

$farmName = "Test_Farm"

$appName = "Google_Chrome_App"

$appDisplayName = "Google Chrome"

$appDescription = "Google Chrome version 64"

$appPublisher = "Google"

$appVersion = "64"

$appExecutionPath = "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"

$appStartFolder = "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"

$appParameters = ""

#Get farmID based on name

$query_service = New-Object "Vmware.Hv.QueryServiceService"

$query = New-Object "Vmware.Hv.QueryDefinition"

$query.queryEntityType = 'FarmSummaryView'

$query.Filter = new-object VMware.Hv.QueryFilterEquals -property @{'memberName' = 'data.name'; 'value' = $farmName}

$RDSFarmInfo = $query_service.QueryService_Query($ViewAPI,$query)

$farmId = $RDSFarmInfo.Results.Id

#Application Data Information

#https://code.vmware.com/apis/75/view

$AppData = New-Object "Vmware.Hv.ApplicationData" -Property @{

    Enabled = $true

    name = $appName

    displayName = $appDisplayName

    description = $appDescription

}

#Application Execution Data

#https://code.vmware.com/apis/75/view

$AppExeData = New-Object "VMware.Hv.ApplicationExecutionData" -Property @{

    executablePath = $appExecutionPath

    startFolder = $appStartFolder

    publisher = $appPublisher

    args = $appParameters

    version = $appVersion

    farm = $farmid

  

}

$AppSpecs = New-Object "VMware.Hv.ApplicationSpec" -Property @{

    data = $AppData

    executionData = $AppExeData

}

#Create AppPool

$ViewAPI.Application.Application_Create($AppSpecs)

disconnect-hvserver

View solution in original post

2 Replies
techguy129
Expert
Expert
Jump to solution

Here is the script I use to create application pools

connect-hvserver "connectionserverfqdn"

$ViewAPI = $global:DefaultHVServers[0].ExtensionData

#User Inputs

$farmName = "Test_Farm"

$appName = "Google_Chrome_App"

$appDisplayName = "Google Chrome"

$appDescription = "Google Chrome version 64"

$appPublisher = "Google"

$appVersion = "64"

$appExecutionPath = "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"

$appStartFolder = "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"

$appParameters = ""

#Get farmID based on name

$query_service = New-Object "Vmware.Hv.QueryServiceService"

$query = New-Object "Vmware.Hv.QueryDefinition"

$query.queryEntityType = 'FarmSummaryView'

$query.Filter = new-object VMware.Hv.QueryFilterEquals -property @{'memberName' = 'data.name'; 'value' = $farmName}

$RDSFarmInfo = $query_service.QueryService_Query($ViewAPI,$query)

$farmId = $RDSFarmInfo.Results.Id

#Application Data Information

#https://code.vmware.com/apis/75/view

$AppData = New-Object "Vmware.Hv.ApplicationData" -Property @{

    Enabled = $true

    name = $appName

    displayName = $appDisplayName

    description = $appDescription

}

#Application Execution Data

#https://code.vmware.com/apis/75/view

$AppExeData = New-Object "VMware.Hv.ApplicationExecutionData" -Property @{

    executablePath = $appExecutionPath

    startFolder = $appStartFolder

    publisher = $appPublisher

    args = $appParameters

    version = $appVersion

    farm = $farmid

  

}

$AppSpecs = New-Object "VMware.Hv.ApplicationSpec" -Property @{

    data = $AppData

    executionData = $AppExeData

}

#Create AppPool

$ViewAPI.Application.Application_Create($AppSpecs)

disconnect-hvserver

mrstorey303
Enthusiast
Enthusiast
Jump to solution

*Exactly* what I was looking for - thanks!

Really helps to see the objects and methods needed to do this - much appreciated.

0 Kudos