如何使用ZTI制定SMS OSD分发脚本
[size=2]该贴转自合作社区——[/size][url=http://www.systemcenter.com.cn/bbs/][size=2]SC中文社区[/size][/url][size=2],请大家支持国内最专业的SystemCenter中文社区![/size][size=2][/size]
[size=2]This scenario describes how to repartition the drive using an OSD (ZTI) Refresh
The SMS 2003 SP1 Server used in this tutorial (including OSD) has all SMS roles. The Servername in this example is Server1 and the domainname is Domain. The The WinPE version used is Windows 2005 with boot-in-ram as well as 32 MB scratchspace (RAMDisk) support. Client computers need to have about 256 MB RAM. All below steps can be performed on the server .
[b]Note 1:[/b] You need to modify OSD (or ZTI) not to use the local disk as User State Location (since we are wiping the disk). If you are using OSD with ZTI you can comment out [b]iRetVal = DoStateCapture(true)[/b] from the ZeroTouchInstallation.vbs script to force ZTI to always store USMT data on the Network. If you are using OSD only you can set the OSDSTATEPATH value to a network share using a custom action.
[b]Note 2:[/b] The WinPE RAMDisk used in this article supports ramdisk (scratchspace) even when booting WinPE 2005 fully into RAM.
Sample files, download.
[/size][url=http://myitforum.techtarget.com/inc/arts/11021winpe_ramdisk.zip][size=2][color=#ff9900]11021winpe_ramdisk.zip[/color][/size][/url][size=2][color=#ff9900]
[/color][/size][url=http://myitforum.techtarget.com/inc/arts/11024zti_refresh_scripts.zip][size=2][color=#ff9900]11024zti_refresh_scripts.zip[/color][/size][/url][size=2]
[b]Create a WinPE 2005 image with a 32 MB scratchspace (RAMDisk)[/b]
1. Copy the [b]WINPE[/b] folder from the Windows PE 2005 CDROM to [b]C:\[/b]
2. Copy the [b]SAMPLES\SERVERSP1-REMOVELIST.TXT[/b] from the Windows PE 2005 CDROM to [b]C:\WINPE[/b]
3. Edit the [b]C:\WINPE\SERVERSP1-REMOVELIST.TXT[/b] file and remove the following lines
[/size][b]
[size=2]inf\net21x4.inf
system32\drivers\dc21x4.sys
system32\mfc42.dll
system32\odbc32.dll
system32\odbcint.dll
system32\urlmon.dll
Note 1[/size][/b][size=2]: [b]urlmon.dll[/b] is required for network support, and the [b]net21x4.inf[/b] and [b]dc21x4.sys[/b] files is for Virtual PC 2004 Nic support.
[b]Note 2[/b]: The [b]mfc42.dll[/b], [b]odbc32.dll[/b] and [b]odbcint.dll[/b] files are needed for the ZTI script. If these files are not present the ZTI process fails with Exit Code 429.
4. Download the sample file [b](winpe_ramdisk.zip)[/b] and extract the [b]winpe_ramdisk.inf[/b] file to [b]c:\WINPE[/b]
5. Modify C:\WINPE\CONFIG.INF using the following info:
Change the line (line 19)
[/size][b]
[size=2]setupreg.hiv = .\winpesys.inf,AddReg
[/size][/b]
[size=2]to
[/size][b]
[size=2]setupreg.hiv = .\winpesys.inf,AddReg,.\winpe_ramdisk.inf,AddReg
[/size][/b]
[size=2]6. Insert the Windows Server 2003 SP1 CD-ROM (F: in this example). Start a command prompt and type:
[/size][b]
[size=2]cd /d c:\winpe
mkimg.cmd F: C:\WinPE_ZTI_Refresh /WMI
[/size][/b]
[size=2][b]Note:[/b] This compiles WinPE 2005 with WMI support
7. Download the evalutation version of Quality Software's RAMDisk from [/size][url=http://users.skynet.be/mysoft/RAMDisk/RAMDisk_WinPE12_Eval.zip][size=2][color=#ff9900]http://users.skynet.be/mysoft/RAMDisk/RAMDisk_WinPE12_Eval.zip[/color][/size][/url][size=2] and extract
the content to [b]C:\[/b]
8. Rename the [b]C:\ramdisk\WinPE\RAMDisk.sys[/b] file to [b]ramdrv.sys[/b]
9. Copy the renamed [b]C:\ramdisk\WinPE\ramdrv.sys[/b] file to [b]C:\WinPE_ZTI_Refresh\i386\system32\drivers[/b]
10. Reduce the size of WinPE to about 100 MB by creating a batchfile named [b]ReduceWinPE.cmd[/b] in the [b]C:\WINPE[/b] folder containing the following lines
[/size][b]
[size=2]cd /d C:\WinPE_ZTI_Refresh\i386
for /f "eol=;" %%i in (C:\winpe\serversp1-removelist.txt) do del /q %%i
[/size][/b]
[size=2]11. Execute the previously created [b]C:\winpe\ReduceWinPE.cmd[/b] batchfile
[b]Add the OSD files and WHS/ADO/HTA support to the WinPE 2005 image[/b]
1. Copy the following files from the OSD installation folder to C:\WinPE_ZTI_Refresh\i386\system32
[/size][b]
[size=2]OSDAGENT.EXE
OSDENV.EXE
[/size][/b]
[size=2]2. Add support for WHS/ADO/HTA by starting a command prompt and type:
[/size][b]
[size=2]cd /d c:\winpe
Buildoptionalcomponents /S:F: /D:C:\WinPE_ZTI_Refresh /Q
[/size][/b]
[size=2][b]Modify the WinPE 2005 image startup script[/b]
1. Edit and replace the contents of the :C:\WinPE_ZTI_Refresh\i386\System32\startnet.cmd file with the following text:
[/size][b]
[size=2]Rem Installing scripting support
Start /Wait "Installing Components" /MIN OC2.bat
Rem Start networking
regsvr32 /s netcfgx.dll
factory -minint
netcfg -v -winpe
net start dhcp
net start nla
Rem Start repartition
copy c:\minint\repart.cmd z:\
z:\repart.cmd
[/size][/b]
[size=2]2. Create a Bootable CD by starting a command prompt and type:
[/size][b]
[size=2]cd /d c:\winpe
oscdimg -h -n -betfsboot.com C:\WinPE_ZTI_Refresh C:\WinPE_ZTI_Refresh.iso
[/size][/b]
[size=2][b]Prepare package on the SMS Server[/b]
1. On [b]Server1[/b], create a folder named [b]D:\Packages\ZTI_Refresh[/b]
2. Copy the previously created [b]C:\WinPE_ZTI_Refresh.iso[/b] file to the [b]D:\Packages\ZTI_Refresh[/b] folder.
3. Create a file named [b]diskpart.txt[/b] in [b]C:\WinPE_ZTI_Refresh\i386\system32[/b] with the following text
[/size][b]
[size=2]Select disk 0
clean
Create Partition Primary size = 8192
Active
Assign Letter = C:
[/size][/b]
[size=2]4. Create a textfile named repart.cmd in the d:\Packages\ZTI_Refresh folder with the following text.
[/size][b]
[size=2]Rem Backup scripts and OSD Config Data from C: to RAMdisk
xcopy C:\MININT\SMSOSD Z:\MININT\SMSOSD /E /I
copy C:\MININT\SMScfg.ini z:\MININT\
copy C:\MININT\diskpart.txt z:\
Rem Perform the Repartitiong (from the RAMDisk)
Diskpart /s z:\diskpart.txt
Rem Format the drive
Format C: /FS:NTFS /v:System /Q /Y
Rem Restore OSD data to C: from RAMdisk
xcopy Z:\MININT C:\MININT /E /I
Rem Continue the OSD process
Start /wait OSDAgent /winpe
Rem Exit and reboot
Exit
[/size][/b]
[size=2]4. Create a text file named [b]Winnt.sif[/b] in the [b]D:\Packages\ZTI_Refresh[/b] folder with the following text:
[/size][b]
[size=2][SetupData]
BootDevice = "ramdisk(0)"
BootPath = "\i386\System32\"
OsLoadOptions = "/noguiboot /fastdetect /minint /rdexportascd /rdpath=\WINPE_ZTI_REFRESH.ISO"
[/size][/b]
[size=2]5. From the [b]C:\WinPE_ZTI_Refresh\i386[/b] folder (WinPE 2005 structure), copy the following files to [b]D:\Packages\ZTI_Refresh[/b].
[/size][b]
[size=2]ntdetect.com
Setupldr.bin
[/size][/b]
[size=2]6. In the d:\Packages\ZTI_Refresh, create a textfile named prepare.cmd folder with the following text.
[/size][b]
[size=2]Rem Check for local User State data, abort if exists
If Exist C:\MININT\SMSOSD\StateStore\USMT2.INC\Nul goto Abort
If Exist C:\MININT\SMSOSD\StateStore\USMT2I.INC\Nul goto Abort
attrib c:\ntdetect.com -h -r -s
ren c:\ntdetect.com ntdetect.old
attrib c:\ntldr -h -r -s
ren c:\ntldr ntldr.old
Copy \\Server1\Packages\ZTI_Refresh\WINPE_ZTI_REFRESH.ISO c:\
Copy \\Server1\Packages\ZTI_Refresh\ntdetect.com c:\
Copy \\Server1\Packages\ZTI_Refresh\Setupldr.bin c:\ntldr
Copy \\Server1\Packages\ZTI_Refresh\Winnt.sif c:\
Copy \\Server1\Packages\ZTI_Refresh\diskpart.txt c:\MININT\
Copy \\Server1\Packages\ZTI_Refresh\repart.cmd c:\MININT\
Goto End
:Abort
Echo Local User State data exists, abort repartition!!!
Exit
:End
Exit
[/size][/b]
[size=2]8. Create an custom action in the State Capture phase (after the state capture action) that executes the [b]prepare.cmd[/b] script.[/size]
页:
[1]