Best Practices Preparing a Provisioning Services vDisk

An article by Trond Eirik Haavarstein from xenappblog.com

In this blog post I will show you my Prepare for PVS script that contains Best Practices obtained after years of experience with Provisioning Services.

Let’s say you’re going to run Windows Updates. Well since you’ve already launched the Target Optimizer tool, that services is disabled and you need to head into services, enable and start it. Run Windows update and all good. When the update is finished you shutdown the machine and switch from Private to Standard Mode.

What you didn’t remember was to reboot the server for Windows Update to complete it’s updates. What happens now, is that every time your servers reboot, Windows Update will kick in and finish it’s things.

windows update Best Practices Preparing a Provisioning Services vDisk

So being only one administrator doing all the procedures is one thing, but when you hand over the solution to your customer or maintenance team, everybody would probably do this differently, forgetting to flush DNS and so on.

So this script will do all these thing for you. Just teach your staff to always run the script after maintenance.

Prerequisites :

Copy Wuinstall to C:\Windows. Run XenAppCloning tool, add your free license and then configure your settings and save the settings to the configuration file.

pvsupdate3 300x259 Best Practices Preparing a Provisioning Services vDisk

Extract the XAUpdate script to C:\XA65Update, rename the script to XA65Update.cmd and configure the settings required inside that script.

Copy the content below into C:\Program Files\Citrix\Prepare for PVS.cmd

@echo off
cls
echo ************************************************************
echo ***** This will prepare the machine for Standard Image *****
echo ************************************************************
echo.
choice /c yn /m "Do you want to Download and Install Windows Updates"
set DRIVENUM=%ERRORLEVEL%
if %DRIVENUM% EQU 1 goto wsus
if %DRIVENUM% EQU 2 goto ctx
:wsus
echo.
echo Enable and Start Windows Update Service
sc config wuauserv start= auto
net start wuauserv
echo.
echo Applying Windows Updates
wuinstall /install
shutdown /r /t 0
goto ctx
:ctx
echo.
choice /c yn /m "Do you want to Download and Install Citrix Hotfixes"
set DRIVENUM=%ERRORLEVEL%
if %DRIVENUM% EQU 1 goto 65update
if %DRIVENUM% EQU 2 goto cont
:65update
call C:\XA65Update\XA65Update.cmd
:cont
echo.
choice /c yn /m "Do you want Defrag the Disk"
set DRIVENUM=%ERRORLEVEL%
if %DRIVENUM% EQU 1 goto defrag
if %DRIVENUM% EQU 2 goto cont1
:defrag
echo.
defrag C:
:cont1
echo.
ipconfig /flushdns
echo.
echo Deleting Windows Update Download Folder
rmdir /s /q "C:\Windows\SoftwareDistribution\Download"
echo.
echo Deleteing Downloaded Citrix Hotfixes
del C:\XA65Update\*.msp /q /s
echo.
echo Running Provisioning Services Optimization Tool
call "c:\Program Files\Citrix\Provisioning Services\TargetOSOptimizer.exe"
echo.
echo Running XenApp Cloning Tool
call "C:\Program Files (x86)\VirtuAll Solutions\XenApp Cloning Tool\XenAppCloningCmd.exe" -Mode:PVS -ConfigFile SilentCloningConfig.ini
shutdown /s /t 30 /c "The System will Shut Down in 30 seconds - Type shutdown /a to Abort"
[/bash]

To get ride of this annoying boot screen

pvsupdate4 Best Practices Preparing a Provisioning Services vDisk

you just added HKLM\Software\Citrix\ProvisioningServices\SkipBootMenu to your PVS servers. Now your maintenance / test machine will automatically boot to the newest version of the vDisk.

pvsupdate2 300x130 Best Practices Preparing a Provisioning Services vDisk

Please be aware that this doesn’t work on Provisioning Services 6.2 hosted on Windows 2012. The good news though, the KMS bug has finally been fixed in Provisioning Services 6.2 (part of Project Excalibur Tech Preview).

So when you e.g. want to patch your Provisioning Services image with the latest Citrix Hotfixes, you just select that option and off you go. The server is rebooted automatically and when it comes back online you just run through the script another time and this time the server will be shutdown ready for you switching from private to standard mode.

pvsupdate1 300x148 Best Practices Preparing a Provisioning Services vDisk

If you have any other Best Practices for Provisioning Services, please leave a comment below and share with the community.

 

Tags: ,

Comments

No comments so far.

  • Leave a Reply
     
    Your gravatar
    Your Name