4.Cobbler自动化安装Windows10

<!doctype html>02_3部署Windows10

定制Win10 PE

下载ADK工具https://go.microsoft.com/fwlink/p/?LinkId=526740

这个下下来之后安装完成之后,在你指定的目录中还有一个adksetup.exe。再次进行安装,并且选择以下功能

win10-1

 

安装完成之后,先打开部署和映像工具环境

win10-2

以管理员身份执行以下命令

 
 
 
 
 
 
 
 
copype amd64 E:\win10pe
imagex /mountrw E:\win10pe\media\sources\boot.wim 1 E:\win10pe\mount
echo ping -n 3 -l 69 192.168.0.196 >> E:\win10pe\mount\windows\system32\startnet.cmd
echo net use z: \\192.168.0.196\share >> E:\win10pe\mount\windows\system32\startnet.cmd
echo z: >> E:\win10pe\mount\windows\system32\startnet.cmd
# 进入win目录中(对应后文中的/smb/win10的win10)
echo cd win10 >> E:\win10pe\mount\windows\system32\startnet.cmd
# 此步为最关键的一步,具体的自动化安装为该步,Autounttend.xml的制作方式后面详细说明
echo setup.exe /unattend:AutoRunWin10.xml >> E:\win10pe\mount\windows\system32\startnet.cmd
# 去除挂载
imagex /unmount E:\win10pe\mount /commit
# 生成Win PE ISO镜像工具
MakeWinPEMedia /ISO E:\win10pe E:\win10pe\win10pe_cobbler_amd64.iso
 

 

配置Cobbler服务端

Cobbler服务端

1.上传ISO镜像到Cobbler Server端

  • win10pe_cobbler_amd64.iso (上面制作完成)
  • cn_windows_10_consumer_editions_version_1909_x64_dvd_76365bf8.iso(纯净版Win10镜像)

2.导入ISO镜像到Cobbler Server端

 
 
 
 
 
 
 
 
# 将winpe_cobbler_amd64.iso镜像拷贝到Cobbler Server端
# 导入镜像
$ cobbler distro add --name=windows10 --kernel=/var/lib/tftpboot/memdisk --initrd=/root/win10pe_cobbler_amd64.iso --kopts="raw iso"
 

3.配置ISO镜像相关的自动值守安装文件

 
 
 
 
 
 
 
 
# 该文件只是一个profile使用而已,其实没有其他作用
$ touch /var/lib/cobbler/kickstarts/win10pe.xml
$ cobbler profile add --name=windows10 --distro=windows10 --kickstart=/var/lib/cobbler/kickstarts/win10pe.xml
 

4.配置samba共享Windows ISO

4.1 安装samba服务
 
 
 
 
 
 
 
 
$ yum -y install samba
$ systemctl start smb && systemctl enable smb
 
4.2 配置共享
 
 
 
x
 
 
 
 
$ vim /etc/samba/smb.conf
[global]
    log file = /var/log/samba/log.%m
    max log size = 5000
    security = user
    guest account = nobody
    map to guest = Bad User
    load printers = yes
    cups options = raw
···
[share]
    comment = This is Samba share directory
    path = /smb/
    directory mask = 0755
    create mask = 0755 
    guest ok = yes
    writable = yes
# 更改配置文件,重启生效
$ systemctl restart smb
$ mkdir -p /smb/win
$ mkdir /mnt/win10
# 将WIN7的镜像挂载到/mnt/win7
$ mount -o loop,ro cn_windows_10_consumer_editions_version_1909_x64_dvd_76365bf8.iso /mnt/win10
# 将镜像中的内容拷贝到samba的共享目录中
$ cp -r /mnt/win10/* /smb/win10/
 

此时我们已经完成了整个流程的一部分,接下来进行调试

本地测试

win10

接下来就是创建真正自动化的文件,AutoRunWin10.xml

5. AutoRunWin10.xml

打开Windows 系统映像管理器

win10-3

打开之后如下界面,跟Win7的工具是一样的,但是不能用之前的工具,之前的用在这里添加镜像,生成编录文件袋额时候会报错。

manager

然后选择映像和编录文件。目录为 E:\ISO\win10\sources\install.wim(将你的win10镜像解压后的sources\install.wim).并且新建应答文件。

注意接下来的所有选择是针对amd64的系统,不要选错了版本,如果你想针对多个系统,就添加不同系统

1.指定地区和语言选项
  • amd64_Microsoft-Windows-International-Core-WinPE

1

设置语言

LayeredDriver ------> 这个是针对日本和韩国,他们的键盘有106.101.102键的

SystemLocale ------> 指定系统的区域设置。

UILanguage -------> 指定用户界面的语言。

UILanguageFallback -------> 指定為預設系統使用者介面 (UI) 的未當地語系化的資源所使用的語言

UserLocale 指定在Windows安装或Windows部署服务期间使用的用户区域设置

语言-1

 

设置安装语言,一定要设置为 en-US,如果设置zh-CN会报错,详见报错1.

语言

2.接受EULA协议

4

设置AcceptEula为 ture

6

如果不设置为true的话,会在如下界面卡住

accept

3.选择镜像版本

7

查看镜像的/image/index值,并设置。

 
 
 
 
 
 
 
 
# 使用前面的  部署和映像工具环境  工具
imagex /info E:\ISO\win10\sources\install.wim
 

8

4.配置磁盘

1

DiskID是硬盘编号,从0开始,表示第一块硬盘

WillWipeDisk表示是否格式化硬盘

2

Order表示硬盘的分区顺序,与后面添加磁盘符标签等时的Order要一致

Extend表示是否拓展,此处我们不设置SIZE,因为每台电脑的磁盘不一样大,所以通过Extend去扩展是最好的,当然也可以指定C盘的大小,再创建剩下的一个盘符去扩展,或者只创建一个C盘,其他的系统创建完成之后手动操作,都是可以的。

Size表示分区大小

Type表示类型,这里设置为主分区

createdisk

1

Active Active指定是否将分区标记为活动分区。在基于BIOS的系统上,活动分区是系统将引导到的分区。此分区必须是主分区

Extend

扩展可用于修改现有分区。您可以在基于BIOS/MBR的系统上使用Extend来:

- 指定新的或现有的逻辑分区以填充扩展分区的其余部分。

- 在现有分区结构中指定一个分区以填充磁盘的其余部分。

Format表示磁盘格式 设置为NTFS

Label表示标签,也就是磁盘的名字

Letter表示磁盘的盘符,这里设置为 C

Order与前面的对应

PartitionID分区ID,与后面设置的要一致

Modify

3

选择系统镜像的安装位置,磁盘ID为0,分区ID为1.与前面的设置对应

4

5.设置用户名和计算机名

Microsoft-Windows-Shell-Setup

1

创建用户XLL

2

设置密码为空

3

用户-3

ComputerName 设置计算机名。 *表示随机生成

用户-4

6.设置windows秘钥

VK7JG-NPHTM-C97JM-9MPGT-3V66T

WillShowUI: 什么情况下显示这个界面,OnError:错误的时候

秘钥-1

7.网络

Micrisift-Windows-Shell-Setup

1

NetworkLocation=work表示工作网络

ProtecYourPC=3表示以后询问我

2

8.时区

TimeZone : China Standard Time

时区

9.用户登录自动登录(可选)

前面创建了XLL用户,如果你想以XLL用户登录,则可以设置用户自动登录,不设置的话,就是默认Administrator登录

AutoLogon

设置自动登录的用户

AutoLogon-1

设置密码

AutoLogon-2

 

 

10.参考
 
 
 
 
 
 
 
 
<?xml version="1.0" encoding="utf-8"?>
<unattend xmlns="urn:schemas-microsoft-com:unattend">
    <settings pass="windowsPE">
        <component name="Microsoft-Windows-International-Core-WinPE" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
            <SetupUILanguage>
                <UILanguage>en-US</UILanguage>
            </SetupUILanguage>
            <InputLocale>zh-CN</InputLocale>
            <SystemLocale>zh-CN</SystemLocale>
            <UILanguage>zh-CN</UILanguage>
            <UserLocale>zh-CN</UserLocale>
        </component>
        <component name="Microsoft-Windows-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
            <UserData>
                <ProductKey>
                    <Key>VK7JG-NPHTM-C97JM-9MPGT-3V66T</Key>
                    <WillShowUI>OnError</WillShowUI>
                </ProductKey>
                <AcceptEula>true</AcceptEula>
            </UserData>
            <DiskConfiguration>
                <Disk wcm:action="add">
                    <CreatePartitions>
                        <CreatePartition wcm:action="add">
                            <Order>1</Order>
                            <Extend>true</Extend>
                            <Type>Primary</Type>
                        </CreatePartition>
                    </CreatePartitions>
                    <DiskID>0</DiskID>
                    <WillWipeDisk>true</WillWipeDisk>
                    <ModifyPartitions>
                        <ModifyPartition wcm:action="add">
                            <Active>true</Active>
                            <Format>NTFS</Format>
                            <Label>OS</Label>
                            <Letter>C</Letter>
                            <Order>1</Order>
                            <PartitionID>1</PartitionID>
                        </ModifyPartition>
                    </ModifyPartitions>
                </Disk>
            </DiskConfiguration>
            <ImageInstall>
                <OSImage>
                    <InstallTo>
                        <DiskID>0</DiskID>
                        <PartitionID>1</PartitionID>
                    </InstallTo>
                </OSImage>
            </ImageInstall>
        </component>
    </settings>
    <settings pass="oobeSystem">
        <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
            <UserAccounts>
                <LocalAccounts>
                    <LocalAccount wcm:action="add">
                        <Password>
                            <Value>UABhAHMAcwB3AG8AcgBkAA==</Value>
                            <PlainText>false</PlainText>
                        </Password>
                        <Group>Administrator</Group>
                        <Name>XLL</Name>
                    </LocalAccount>
                </LocalAccounts>
            </UserAccounts>
            <OOBE>
                <NetworkLocation>Work</NetworkLocation>
                <ProtectYourPC>3</ProtectYourPC>
            </OOBE>
        </component>
    </settings>
    <settings pass="specialize">
        <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
            <ComputerName>*</ComputerName>
            <TimeZone>China Standard Time</TimeZone>
            <AutoLogon>
                <Password>
                    <Value>UABhAHMAcwB3AG8AcgBkAA==</Value>
                    <PlainText>false</PlainText>
                </Password>
                <Enabled>true</Enabled>
                <LogonCount>1</LogonCount>
                <Username>XLL</Username>
            </AutoLogon>
        </component>
    </settings>
    <cpi:offlineImage cpi:source="wim:e:/iso/win10/sources/install.wim#Windows 10 zyb x64" xmlns:cpi="urn:schemas-microsoft-com:cpi" />
</unattend>
 

 

 

6.报错

6.1 报错1

报错-1

posted @ 2020-03-04 14:15  情浅凉心  阅读(6062)  评论(0编辑  收藏  举报