I just stumpled upon the post Sealing Steps After Updating a vDisk by Citrix Consulting Services. The post includes the step-by-step process with 22 manual steps that NEEDS to be performed every time the MCS or PVS image is updated.
While I don’t believe in manual work and the fact that the vDisk should be rebuilt instead of updated, the content of this post will help you anyway.
Now, why do something manually when there exist a Framework called Base Image Script Framework (BISF)? Not only does it also support XenApp 6.5, it also have 44 automated steps with a fantastic logging feature.
Are you using FSLogix? Well then the script will automatically delete and copy your ruleset from a network share. That’s just one of the many fantastic features. Let’s get started!
In Automating Citrix PVS Image Creation with MDT Part I I showed you how to use BISF with MDT and XenConvert. Now after lots of testing P2PVS is a faster and more reliable approach.
Citrix Provisioning Services 7.7 with a VHDX vDisk is super fast, see the demo video at the end of this post.
Thanks a million to former CTP Jeremy Saunders for sharing his experience and scripts.
Download and extract BIFS and create a Install.cmd in the root folder. The reason is that BIFS will break the MDT logics.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
@echo off :: Syntax: :: install.cmd <driveletter> :: - where driveletter is the PVSWriteCacheDisk drive SetLocal SET SOURCE=%~dp0 SET SOURCE=%SOURCE:~0,-1% :: Set the BISF Version Set Version=5.0.2 cls echo. echo Installing Login Consultants Base Image Script Framework echo. IF "%1"=="" ( Set PVSWriteCacheDisk= Echo Missing the PVSWriteCacheDisk Drive Letter variable GOTO Finish ) Else ( Set PVSWriteCacheDisk=%1 Echo Using %1 as the PVSWriteCacheDisk variable ) ::---Prerequisites Currently Not in BISF----- Echo Making modifications to Scheduled Tasks... SET tmpfile=%TEMP%\schtasks.txt schtasks /query > %tmpfile% findstr /B /I "ScheduledDefrag" %tmpfile% >nul 2>&1 if %errorlevel%==0 schtasks /change /TN "\Microsoft\Windows\Defrag\ScheduledDefrag" /Disable >nul 2>&1 findstr /B /I "RegIdleBackup" %tmpfile% >nul 2>&1 if %errorlevel%==0 schtasks /change /TN "\Microsoft\Windows\Registry\RegIdleBackup" /Disable >nul 2>&1 findstr /B /I "MP Scheduled Scan" %tmpfile% >nul 2>&1 if %errorlevel%==0 schtasks /change /TN "\Microsoft\Windows Defender\MP Scheduled Scan" /Disable >nul 2>&1 ::------------------------------------------- ::----------Prerequisites for MDT------------ :: Disable the AutoAdminLogon set by MDT REG ADD "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v AutoAdminLogon /d "0" /t REG_DWORD /f ::---------------------------------------------------------------------- ::----------Enable Services Required by XenConvert and P2PVS------------ sc config vss start= auto net start vss sc config swprv start= auto net start swprv ::------------------------------------------- ::-------------Copy & Run BISF--------------- Echo Copying scripts... IF NOT EXIST "%SYSTEMDRIVE%\PersonalisationScripts" MD "%SYSTEMDRIVE%\PersonalisationScripts" xcopy "%SOURCE%\%Version%\*.*" "%SYSTEMDRIVE%\PersonalisationScripts\" /e/s/v/y Echo Running BISF... PUSHD "%SYSTEMDRIVE%\PersonalisationScripts" CALL "PrepareBaseImage.cmd" %PVSWriteCacheDisk% POPD ::------------------------------------------- ::---------------MDT Cleanup----------------- Echo Removing remnants of MDT from the PVS vDisk... IF EXIST D:\MININT SET PVSvDisk=D IF EXIST E:\MININT SET PVSvDisk=E IF EXIST F:\MININT SET PVSvDisk=F IF EXIST G:\MININT SET PVSvDisk=G IF EXIST "%PVSvDisk%:\MININT" RD /Q /S "%PVSvDisk%:\MININT" IF EXIST "%PVSvDisk%:\_SMSTaskSequence" RD /Q /S "%PVSvDisk%:\_SMSTaskSequence" IF EXIST "%PVSvDisk%:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup\LiteTouch.lnk" DEL /Q "%PVSvDisk%:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup\LiteTouch.lnk" ::------------------------------------------- :Finish endlocal |
Then copy and replace the following into PrepareBaseImage.cmd.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
@echo off PushD "%~dp0" mode con: cols=190 lines=60 IF NOT "%1"=="" ( Set PVSWriteCacheDisk=%1: Echo The PVSWriteCacheDisk variable is set to %1: ) Else ( Echo The PVSWriteCacheDisk variable has not been set GOTO End ) echo initialize script environment... please wait SET Files.PT=%~dp0BISF_SCRIPTS Powershell.exe -command "set-executionpolicy Bypass" >NUL REM Powershell.exe -file "%Files.PT%\10_XA_MAIN_PrepBISF.ps1" REM Example for CLI silentmode REM Powershell.exe -file "%Files.PT%\10_XA_MAIN_PrepBISF.ps1" -sDelete NO -defrag NO -AVFullScan NO -OSrearm YES -OFrearm YES -CtxPvd NO -CCleaner YES -VIEScan YES -RstPerfCnt YES powershell.exe -ExecutionPolicy Bypass -Command "& '"%Files.PT%\10_XA_MAIN_PrepBISF.ps1"' -sDelete NO -FSXdelRules YES -FSXRulesShare "%XA%\fslogix" -defrag YES -AVFullScan NO -VIEscan NO -OSrearm NO -OFrearm NO -CtxPvd NO -P2PVS -CCleaner YES -RstPerfCnt YES" :: -sDelete NO :: -defrag YES :: -OSrearm YES :: -OFrearm YES :: -AVFullScan NO :: -VIEscan NO :: -CtxPvd NO :: -P2PVS :: -CCleaner NO :: -RstPerfCnt NO :: -shutdown NO :: -SuppressPndReboot :: -Verbose PopD |
Now, because we want to use D:\ at the PVSWriteCacheDisk it’s highly recommened to change the drive letter for your CD-Rom. The following script can be use to fix that. I’m changing mine to B: as you can see in the end of the command.
1 |
(gwmi Win32_cdromdrive).drive | %{$a = mountvol $_ /l;mountvol $_ /d;$a = $a.Trim();mountvol b: $a} |
Finally add the magic to MDT.
1 |
powershell.exe -ExecutionPolicy Bypass .\ChangeCDRomDriveLetter.ps1 -force |
Now whenever you update your PVS vDisk or MCS image simply run the script as part of your sealing process.
PVS with WriteCacheDisk
1 |
C:\PersonalisationScripts\PrepareBaseImage.cmd D |
MCS without WriteCacheDisk
1 |
C:\PersonalisationScripts\PrepareBaseImage.cmd C |
Hi Eric, thx for this Blog to see the power of BIS-F for PVS or MCS environment can easily help to seal the image.
regards
Matthias
Hi Erik,
thank you for the two parts of you experience to create a PVS vDisk with BIS-F and MDT.
I did the same with SCCM OSD Task Sequence, but I noticed that either the Operating System nor MS Office is correctly rearmed. I’ve added the rearming commands as a step before the BIS-F runs. Did you noticed the same?
Regards
Ben
Hi Ben, I’m not using SCCM, but reach out to @MatthiasSchlimm on Twitter (the creator of BIS-F).
Hi Ben,
please send e mail to [email protected] with a problem description and attach the BIS-F logfile.
regards
Matthias