WebInterface Standardseiten aufsetzen

Na? Auch schon mal ein Citrix Webinterface installiert? Bestimmt.
Und was macht man danach? Sites einrichten natürlich. Die beiden üblichen - demnächst ja vielleicht drei Sites. Aber momentan richtet man doch üblicherweise eine XenAppWeb und eine XenAppServices Site ein (Access Interface / PNAgent).
Da die Konfiguration in den meisten Szenarien ähnlich aussehen dürfte, habe ich diesen Vorgang (wie hier üblich) als kleine Batch-Datei zusammengefasst. Ergebnis ist eine XenApp- und eine Services-Site, weitere Anpassungen sind über die Citrix WebInterface Management-Konsole jederzeit selbst machbar.
Die Batch-Datei fragt nach, ob mit Standard-Werten (Pfade, Server) gearbeitet werden soll, man kann aber auch eigene Angaben interaktiv machen. Ich habe für den Fall, dass diese Batchdatei selbst geskriptet aufgerufen wird, einen Parameter vorgesehen, der nichts mehr fragt und stattdessen flott ein Ergebnis liefert (/stfu).


Hier ist der WIzard of OS :-)


@echo off
rem ### contact daniel.wipperfuerth@adn.de for info / improvements.
echo ######
echo ### script to set up two simple, standard websites for WI.
echo ### The created XA Web Site will be the standard site for IIS!
echo ### This script can be started with /stfu to just create two sites
echo ### without asking anything.
echo ### BE SURE YOU UNDERSTAND WHAT THIS SKRIPT IS DOING BEFORE RUNNING IT
echo ######

rem ### Declaring default variables - you can customize these - but script asks for path
setlocal
rem ### XAWPath specifies the XenApp Web-path - where do you want the website to be?
rem ### XAPNAPath specifies the XenApp Services Site-Path
rem ### If no parameter is given, i take the following defaults
set XAWpath=/Citrix/XenApp
set XAPNAPath=/Citrix/PNAgent
set XAServers=localhost
set XMLPort=80

rem ### SECTION ONE - gathering info
rem ### Find out if we are running on 64bit to get deviant path of sitemgr.exe
if defined ProgramFiles(x86) (for /F "usebackq delims==" %%n in (`dir /b /s "%ProgramFiles(x86)%\citrix\web interface\sitemgr.exe"`) do set smgrpath=%%n) else (for /F "usebackq delims==" %%n in (`dir /b /s "%ProgramFiles%\citrix\web interface\sitemgr.exe"`) do set smgrpath=%%n)
rem ### Find out if we are in stfu-mode
if "%1"=="" (goto :nostfu)
if /i %1==/stfu (goto :setitup)
:nostfu

rem ### Ask if Wi Sites should be created in the default path
:askfordefaults
set /P WantDefaults=Do you want to use /citrix/xenapp and /citrix/pnagent (y/n)?
if %WantDefaults%==y goto :askforservers
if %WantDefaults%==n goto :usecustompaths
echo You entered %WantDefaults%, but i expected a single y or n. I will ask again.
goto :askfordefaults

rem ### Ask if default server and xml port should be used
:askforservers
set /P WantDefaultServers=Do you want to use localhost and XML Port 80 (y/n)?
if %WantDefaultServers%==y goto :setitup
if %WantDefaultServers%==n goto :usecustomservers
echo You entered %WantDefaultServers%, but i expected a single y or n. I will ask again.
goto :askforservers



rem ### SECTION TWO - ask for custom paths or servers
:usecustompaths
echo Choose your paths - but do not forget the /slash...
set /P XAWpath=Enter XA Web Path (like /Citrix/XenApp):
set /P XAPNAPath=Enter XA Web Path (like /Citrix/PNAgent):
goto :askforservers

:usecustomservers
echo Enter your XA Servers - separate Servers with a semicolon (like XA1;XA2;XA3)
set /P XAServers=Enter your XA Servers (like XA1 or XA1.ADN.DEMO):
set /P XMLPort=Enter your XML Port (like 80 or 8080):
goto :setitup



rem ### SECTION THREE - create sites for a better world
rem ### Let`s rock
:setitup
echo Making your WI a homely place - please wait...
echo This takes usually less than 2 minutes.
echo XA Web Site creation starting
"%smgrpath%" -c "WIDest=1:%XAWpath%,WIDefaultSite=Yes,FarmName=MyFarm,XMLService=%XAServers%,XMLSPort=%XMLPort%,XMLSProtocol=HTTP,AppAccessMethods=Remote;Streaming"
if %errorlevel% GTR 0 (echo Errorlevel was %errorlevel%) else echo XA Web Site creation finished
echo XA Services Site creation starting
"%smgrpath%" -c "PNADest=1:%XAPNAPath%,FarmName=MyFarm,XMLService=%XAServers%,XMLSPort=%XMLPort%,XMLSProtocol=HTTP,AppAccessMethods=Remote;Streaming"
if %errorlevel% GTR 0 (echo Errorlevel was %errorlevel%) else echo XA Services Site creation finished

rem ### cleaning up
:end
endlocal
pause

Kommentare

Beliebte Posts aus diesem Blog

Auf NFS Shares mit Windows zugreifen

Citrix Default Passwords

XenServer mit Software-Raid einrichten