Other automation blogs I posted :
XenApp 6 Automation
XenDesktop 5 Automation
XenApp 4.5 / 5 Automation

Today, I needed to prepare the deployment of Citrix PVS servers in silent mode, as usual I’m using a distribution / deployment software like Altiris or SCCM to use the scripts you will read in this blog. The following scripts have been found on the Citrix Community and it was so well done by Kevin Bacon I didn’t want and need to build another one from scratch. To deploy the console and the PVS server, we use PowerShell because I needed to add as well a Windows Feature .NET Framework 3.5.1 before begining the Provisioning Services Server deployment. I bring some modification to these scripts to auto install the .Net Framework Feature, add log files for the installation troubleshooting and the PVS console installation.

Unattended installation and PVS farm creation

This first cmd script is the one to run to start the silent installation :

@ECHO OFF
CLS
Echo Enabling PowerShell Scripts ...
reg add HKLMSoftwareMicrosoftPowerShell1ShellIdsMicrosoft.PowerShell /v ExecutionPolicy /d Unrestricted /f
Echo Executing Build Script ...
%windir%system32WindowsPowerShellv1.0powershell -nologo "& ""c:PVS_Auto_InstallFramework.ps1"""
%windir%system32WindowsPowerShellv1.0powershell -nologo "& ""c:PVS_Auto_InstallPVSsilent.ps1"""
Echo Build Complete
PAUSE

This PowerShell very short script add the Framework 3.5.1 feature and is launch by the PVSinit.cmd launch script. (Thanx to Joe Shonk IV)

Import-Module Servermanager
Add-WindowsFeature NET-Framework-Core

and this is the big piece and thanks again to Kevin for this work, you will need two tools from the Microsoft Resource Kit ntrights.exe and subinacl.exe. (more…)

18 130

  • Joe Shonk

    Stephane,
    Consider using
    add-windowsfeature net-framework-core
    instead of
    add-windowsfeature as-net-framework

    The as-net-framework also installs the Application Server and a bunch of other crap that is not needed for PVS.

    Joe

  • Consider using
    add-windowsfeature net-framework-core
    instead of
    add-windowsfeature as-net-framework

    The as-net-framework also installs the Application Server and a bunch of other crap that is not needed for PVS.

  • Hi Joe

    Thx for the information 🙂

    Cheers,

    Stephane

  • 26th march 2011 : Last script PVSconfig.ps1 has been added to auto add a PVS server to a farm with the ConfigWizard.ans file

  • Mike

    I’m getting errors when the script tries to create the server objects in the database, and also when trying to configure the farm and server objects.

    I start by running the DBScript.exe utility, for my testing I just kept all the defaults (ProvisioningServices, Farm, Site and Collection) except for the farm administrator I entered the local administrator account machinenameAdministrators. I ran this file on the DB server to create the database and tables.

    When I come back to he PVS server and run the PVSsilent.ps1 script it gives me an error similar to this each time the MCLI.exe command are run with their corresponding variables.

    The error I get in the mcli.log file is this:

    2011-06-15 11:38:36,691 [1] INFO MapiCLI.MapiCLI – ========================================
    2011-06-15 11:38:36,722 [1] INFO MapiCLI.MapiCLI – MCLI initialized
    2011-06-15 11:38:36,722 [1] INFO EnterpriseAccess.Access – Connecting with logged in user credentials to localhost
    2011-06-15 11:38:37,253 [1] INFO EnterpriseAccess.Access – connected
    2011-06-15 11:38:52,081 [1] FATAL EnterpriseAccess.HandlerBase – DatabaseOpenFailedHandler
    2011-06-15 11:38:52,081 [1] FATAL EnterpriseAccess.HandlerBase – return code: 32
    2011-06-15 11:38:52,081 [1] FATAL EnterpriseAccess.HandlerBase – exception type: DatabaseOpenFailed
    2011-06-15 11:38:52,081 [1] FATAL EnterpriseAccess.HandlerBase – message: An attempt to open the database failed. Check setup.
    2011-06-15 11:38:52,081 [1] FATAL EnterpriseAccess.HandlerBase – source: Mapi
    2011-06-15 11:38:52,081 [1] FATAL EnterpriseAccess.HandlerBase – inner exception type: SqlException
    2011-06-15 11:38:52,081 [1] FATAL EnterpriseAccess.HandlerBase – inner exception message: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 – Could not open a connection to SQL Server)
    2011-06-15 11:38:52,081 [1] FATAL EnterpriseAccess.HandlerBase – inner exception source: .Net SqlClient Data Provider
    2011-06-15 11:38:52,081 [1] FATAL EnterpriseAccess.HandlerBase – inner exception data:
    2011-06-15 11:38:52,081 [1] FATAL EnterpriseAccess.HandlerBase – HelpLink.ProdName=Microsoft SQL Server
    2011-06-15 11:38:52,081 [1] FATAL EnterpriseAccess.HandlerBase – HelpLink.EvtSrc=MSSQLServer
    2011-06-15 11:38:52,081 [1] FATAL EnterpriseAccess.HandlerBase – HelpLink.EvtID=2
    2011-06-15 11:38:52,081 [1] FATAL EnterpriseAccess.HandlerBase – HelpLink.BaseHelpUrl=http://go.microsoft.com/fwlink
    2011-06-15 11:38:52,081 [1] FATAL EnterpriseAccess.HandlerBase – HelpLink.LinkId=20476
    2011-06-15 11:38:52,097 [1] ERROR MapiCLI.CLICommand – ***Error, Add failed: The database failed to open. The system setup is probably incorrect.
    2011-06-15 11:38:52,191 [1] INFO MapiCLI.MapiCLI – MCLI terminating
    2011-06-15 11:38:52,191 [1] INFO MapiCLI.MapiCLI – ========================================

    The Named Pipes and TCP/IP are enable on the DB server and the SQL Server Browser service is started

    I didn’t change anything in the script but I’m wondering why the Instance variable is commented out and why there is no variable for the Farm?

    Can anyone help with this problem? I have a total of 36 different farms to create as well as 24 additional servers to be added to certain farms for failover. This script would help a lot.

    Thanks

    Mike

  • Hi Mike,
    It looks like your local administrator is used to access the database but have no rights…
    Is your database on another server ?

    Stephane

  • Mike

    Hi,

    Thank you for the quick response. Yes it’s on a different server and the service is starting with the Network Service account.

    Thank you,

    Mike

  • Mike,

    I think you have a right access to the DB issue. You should try to run the script with an account able to modify the database.
    My lab at home is broken, so I cannot try to reproduce your problem…

    Stephane

  • Mike

    I agree it’s a permissions problem but I have no idea what the permissions should be. I’ve put a lot of hours into figuring this out but it’s still not working, I keep getting the same error that I posted above

    Here is what I have done.

    First, on the PVS server, I run DBscript.exe to create a SQL script that I run that on the SQL server to create the ProvisioningServices database and tables. Still on the SQL server, I add the account that runs the SOAP and Stream services to the db_datawriter, db_datareader and db_dataaccess roles. Then on my PVS server I run the PVSinit file and enter the appropriate parameters, but it does not work, I always get the same error.

    When I do this through the ConfigWizard, using the same accounts and parameters, it works, but using the scripts … it does not work.

    Any help would be greatly appreciated.

    Mike

  • Pingback: Citrix Provisioning Services 5.6 automation | Share your knowledge()

  • Pingback: @archynet()

  • Pingback: @vmdude_fr()

  • Pingback: @BeCTXGrp()

  • Hi Stephane,
    any reason why you’re adding the DB registry keys in the PVSSilent.ps1?
    Shouldn’t this happen during automatically during install?

  • Hi David,

    Yes it should but in 5.6 it doesn’t, maybe in 6.x now it’s working I didn’t had the time to try it yet.

    Stephane

  • Well, in 6.1 in one of my environments it does, in other environments it doesn’t!
    PVS is quite a real PITA when it comes to automation!!!

  • Yeah I know that and what’s worry me is the newest product are going on the same track…

  • Pingback: Automating Citrix Provisioning Server Install with RES AM | Virtual Engine()