Creating Horizon application pools manually can be a time-consuming task. Click add, manually fill all of the fields… it’s at least a one minute process per application.

Well, thanks to the HV.Helper module, creating app pools can be very easy to automate! While each app pool takes about a minute to do per pool manually, this script can have a hundred created within a minute! This is great for quickly spinning up labs, or even quickly getting a redundant pod’s app pools up and configured. The simple script at the bottom of this post, called New-HVAppsFromCSV, can do this for you. You’ll need both PowerCLI and the HV.Helper modules available. Here’s what it looks like:

1) Save the script as a .ps1 file (eg., New-HVAppsFromCSV.ps1)

2) Populate the CSV with the following fields: name, farm, executablepath, startfolder, args (startfolder and args can be left blank):

3) Run the script, inputting both the Connection Server and CSV file as arguments, like below:

The script will then loop through each application defined in the CSV and automatically create them all! Here’s what the script looks like:

param (
    [string]$CS = "cs",
    [string]$CSV = ".\apps.csv"
    )

Write-Host -ForegroundColor Green "Connecting to $CS and attempting to import $CSV..."

try
{
$apps = Import-CSV $CSV
}
catch
{
Write-Host -ForegroundColor Red "Failed to find CSV! Please ensure you import a valid CSV with the -csv flag!"
Read-Host "Press enter to continue..."
exit
}

try
{
Connect-HVServer $CS
}
catch
{
Write-Host -ForegroundColor Red "Login seems to have failed! Make sure to use DOMAIN\username format and that you have appropriate PS modules!"
Read-Host "Press enter to continue..."
exit
}

ForEach ($app in $apps)
{
New-HVManualApplication -Name $app.name -Farm $app.farm -ExecutablePath $app.executablepath -StartFolder $app.startfolder -args $app.args
}

As always, if you have questions or issues with this script, shoot me an email. Hope this is helpful!