分类 电脑 下的文章

DCImanager 5 - Windows 11 简体企业90天试用版 - Unattend.xml

遇到的问题:C:\Windows\Panthercbs_unattend.txt 会记录驱动的自动搜寻和安装信息,如:

2024-02-05 15:46:22, Info                  DISM   DISM Driver Manager: PID=1116 TID=396 Searching for drivers at 'X:\windows\ndis68'... ( HRESULT = 0x0 ) - DriversCallback
2024-02-05 15:46:22, Info                  DISM   DISM Driver Manager: PID=1116 TID=396 Locating INFs in 'X:\windows\ndis68' ( HRESULT = 0x0 ) - DriversCallback
2024-02-05 15:46:22, Error                 DISM   DISM Driver Manager: PID=1116 TID=396 Failed to find driver packages at 'X:\windows\ndis68' ( HRESULT = 0x80070003 ) - DriversCallback
2024-02-05 15:46:22, Info                  DISM   DISM Driver Manager: PID=1116 TID=396 Installed '0' drivers. ( HRESULT = 0x0 ) - DriversCallback
2024-02-05 15:46:22, Info                  DISM   DISM Driver Manager: PID=1116 TID=396 RETURN InstallDriversOffline (0) ( HRESULT = 0x0 ) - DriversCallback
2024-02-05 15:46:23, Info                  DISM   DISM Driver Manager: PID=1116 TID=396 Attempting to delete [{bf1a281b-ad7b-4476-ac95-f47682990ce7}D:/Windows/system32/config/SOFTWARE\Microsoft\Windows NT\CurrentVersion\UnattendSettings\PnpUnattend] registry key. - CDriverManager::Internal_DoUnattendCleanup
2024-02-05 15:46:23, Info                  DISM   DISM Driver Manager: PID=1116 TID=396 Successfully deleted [{bf1a281b-ad7b-4476-ac95-f47682990ce7}D:/Windows/system32/config/SOFTWARE\Microsoft\Windows NT\CurrentVersion\UnattendSettings\PnpUnattend] registry key. - CDriverManager::Internal_DoUnattendCleanup
2024-02-05 15:46:24, Info                  DISM   DISM OfflineSetup Provider: PID=1116 TID=396 Applying User Accounts. - COfflineSetupManager::ApplyUserAccounts

<Path>%windir%\ndis68</Path>

2024-02-06 01:14:42, Info                  DISM   DISM WIM Provider: PID=416 TID=1128 [D:\] is not a WIM mount point. - CWimMountedImageInfo::Initialize
2024-02-06 01:14:42, Info                  DISM   DISM VHD Provider: PID=416 TID=1128 [D:\] is not recognized by the DISM VHD provider. - CVhdImage::Initialize

2024-02-06 01:14:50, Info                  DISM   DISM Driver Manager: PID=1408 TID=1048 Locating INFs in 'd:\windows\ndis68' ( HRESULT = 0x0 ) - DriversCallback
2024-02-06 01:14:50, Info                  DISM   DISM Driver Manager: PID=1408 TID=1048 Found file e1d68x64.cat ( HRESULT = 0x0 ) - DriversCallback
2024-02-06 01:14:50, Info                  DISM   DISM Driver Manager: PID=1408 TID=1048 Found file e1d68x64.din ( HRESULT = 0x0 ) - DriversCallback

这例是前后两次不同路径的对比。DISM 未能在 X:\windows\ndis68 查找到驱动,因为使用了如 %windir% 的路径,实际上当时 WinPE 是识别到硬盘的第二个分区,即 D: ,这应该是分区或指定用第二个分区来装 Windows 的原因。我是将驱动的添加放到 Microsoft-Windows-PnpCustomizationsWinPE ,并不是在 Microsoft-Windows-PnpCustomizationsNonWinPE 。

Unattend.xml 内容如下:

<?xml version="1.0" encoding="utf-8"?>
<unattend xmlns="urn:schemas-microsoft-com:unattend">
    <settings pass="windowsPE">
        <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">
                    <RunSynchronous>
                <RunSynchronousCommand wcm:action="add">
                    <Order>1</Order>
                    <Path>reg add HKLM\System\Setup\LabConfig /v BypassTPMCheck /t reg_dword /d 0x00000001 /f</Path>
                </RunSynchronousCommand>
                <RunSynchronousCommand wcm:action="add">
                    <Order>2</Order>
                    <Path>reg add HKLM\System\Setup\LabConfig /v BypassSecureBootCheck /t reg_dword /d 0x00000001 /f</Path>
                </RunSynchronousCommand>
                <RunSynchronousCommand wcm:action="add">
                    <Order>3</Order>
                    <Path>reg add HKLM\System\Setup\LabConfig /v BypassRAMCheck /t reg_dword /d 0x00000001 /f</Path>
                </RunSynchronousCommand>
                <RunSynchronousCommand wcm:action="add">
                    <Order>4</Order>
                    <Path>reg add HKLM\System\Setup\LabConfig /v BypassCPUCheck /t reg_dword /d 0x00000001 /f</Path>
                </RunSynchronousCommand>
                <RunSynchronousCommand wcm:action="add">
                    <Order>5</Order>
                    <Path>reg add HKLM\System\Setup\LabConfig /v BypassStorageCheck /t reg_dword /d 0x00000001 /f</Path>
                </RunSynchronousCommand>
            </RunSynchronous>
            <UserData>
                <AcceptEula>true</AcceptEula>
            </UserData>
            <DiskConfiguration>
                <WillShowUI>OnError</WillShowUI>
                <Disk wcm:action="add">
                    <CreatePartitions>
                        <CreatePartition wcm:action="add">
                            <Order>1</Order>
                            <Size>100</Size>
                            <Type>Primary</Type>
                        </CreatePartition>
                        <CreatePartition wcm:action="add">
                            <Extend>true</Extend>
                            <Order>2</Order>
                            <Type>Primary</Type>
                        </CreatePartition>
                    </CreatePartitions>
                    <ModifyPartitions>
                        <ModifyPartition wcm:action="add">
                            <Active>true</Active>
                            <Format>NTFS</Format>
                            <Label>System</Label>
                            <Order>1</Order>
                            <PartitionID>1</PartitionID>
                        </ModifyPartition>
                        <ModifyPartition wcm:action="add">
                            <Order>2</Order>
                            <PartitionID>2</PartitionID>
                            <Label>Windows</Label>
                            <Letter>C</Letter>
                            <Format>NTFS</Format>
                        </ModifyPartition>
                    </ModifyPartitions>
                    <DiskID>0</DiskID>
                    <WillWipeDisk>true</WillWipeDisk>
                </Disk>
            </DiskConfiguration>
            <ImageInstall>
                <OSImage>
                    <InstallTo>
                        <DiskID>0</DiskID>
                        <PartitionID>2</PartitionID>
                    </InstallTo>
                    <InstallFrom>
                        <MetaData wcm:action="add">
                            <Key>/IMAGE/INDEX</Key>
                            <Value>1</Value>
                        </MetaData>
                    </InstallFrom>
                    <WillShowUI>OnError</WillShowUI>
                    <InstallToAvailablePartition>false</InstallToAvailablePartition>
                </OSImage>
            </ImageInstall>
        </component>
        <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>007f:00000804</InputLocale>
            <SystemLocale>zh-CN</SystemLocale>
            <UILanguage>zh-CN</UILanguage>
            <UILanguageFallback>zh-CN</UILanguageFallback>
            <UserLocale>zh-CN</UserLocale>
 </component>
 
               <component name="Microsoft-Windows-PnpCustomizationsWinPE" 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">
            <DriverPaths>
                <PathAndCredentials wcm:action="add" wcm:keyValue="1">
                    <Path>c:\windows\ndis68</Path>
                </PathAndCredentials>
                <PathAndCredentials wcm:action="add" wcm:keyValue="2">
                    <Path>d:\windows\ndis68</Path>
                </PathAndCredentials>    
            </DriverPaths>            
            </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>
                <AdministratorPassword>
                    <Value>($PASS)</Value>
                </AdministratorPassword>
            </UserAccounts>
            <OOBE>
                <HideEULAPage>true</HideEULAPage>
            <SkipMachineOOBE>true</SkipMachineOOBE>
            <SkipUserOOBE>true</SkipUserOOBE>
            <HideOEMRegistrationScreen>true</HideOEMRegistrationScreen>
            <HideWirelessSetupInOOBE>true</HideWirelessSetupInOOBE>
        <ProtectYourPC>3</ProtectYourPC>
            </OOBE>
        </component>
        <component name="Microsoft-Windows-International-Core" 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">
            <InputLocale>007f:00000804</InputLocale>
            <SystemLocale>zh-CN</SystemLocale>
            <UILanguage>zh-CN</UILanguage>
            <UserLocale>zh-CN</UserLocale>
        </component>
    </settings>
    <settings pass="offlineServicing">
    </settings>
<settings pass="specialize">
    <component name="Microsoft-Windows-TCPIP" 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">
        <Interfaces>
            <Interface wcm:action="add">
                <Ipv4Settings>
                    <DhcpEnabled>false</DhcpEnabled>
                    <RouterDiscoveryEnabled>false</RouterDiscoveryEnabled>
                </Ipv4Settings>
                <Ipv6Settings>
                    <DhcpEnabled>false</DhcpEnabled>
                    <RouterDiscoveryEnabled>false</RouterDiscoveryEnabled>
                </Ipv6Settings>
                <Identifier>($WIN_MAC)</Identifier>
                <UnicastIpAddresses>
                    <IpAddress wcm:action="add" wcm:keyValue="1">($IP)/($NETMASK_SHORT)</IpAddress>
                    <IpAddress wcm:action="add" wcm:keyValue="2">($IPv6)/($NETMASKv6)</IpAddress>
                </UnicastIpAddresses>
                <Routes>
                    <Route wcm:action="add">
                        <Identifier>1</Identifier>
                        <Metric>10</Metric>
                        <NextHopAddress>($GATEWAYv4)</NextHopAddress>
                        <Prefix>0.0.0.0/0</Prefix>
                    </Route>
                    <Route wcm:action="add">
                        <Identifier>2</Identifier>
                        <Metric>10</Metric>
                        <NextHopAddress>($GATEWAYv6)</NextHopAddress>
                        <Prefix>::/0</Prefix>
                    </Route>
                </Routes>
            </Interface>
            <!--Interface wcm:action="add">
                <Ipv4Settings>
                    <DhcpEnabled>false</DhcpEnabled>
                    <RouterDiscoveryEnabled>false</RouterDiscoveryEnabled>
                </Ipv4Settings>
                <Ipv6Settings>
                    <DhcpEnabled>false</DhcpEnabled>
                    <RouterDiscoveryEnabled>false</RouterDiscoveryEnabled>
                </Ipv6Settings>
                <Identifier>Ethernet 2</Identifier>
            </Interface-->
        </Interfaces>
    </component>
    <component name="Microsoft-Windows-DNS-Client" 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">
        <Interfaces>
            <Interface wcm:action="add">
                <Identifier>($WIN_MAC)</Identifier>
                <DNSDomain>($HOSTNAME)</DNSDomain>
                <DNSServerSearchOrder>
                    <IpAddress wcm:action="add" wcm:keyValue="1">($NAMESERVER)</IpAddress>
                </DNSServerSearchOrder>
                <DisableDynamicUpdate>false</DisableDynamicUpdate>
                <EnableAdapterDomainNameRegistration>false</EnableAdapterDomainNameRegistration>
            </Interface>
        </Interfaces>
    </component>
    <component name="Microsoft-Windows-TerminalServices-LocalSessionManager" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS">
          <fDenyTSConnections>false</fDenyTSConnections>
      </component>
      <component name="Microsoft-Windows-TerminalServices-RDP-WinStationExtensions" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS">
          <UserAuthentication>0</UserAuthentication>
      </component>
    <component name="Networking-MPSSVC-Svc" 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">
        <FirewallGroups>
            <FirewallGroup wcm:action="add" wcm:keyValue="RemoteDesktop">
                <Active>true</Active>
                <Group>@FirewallAPI.dll,-28752</Group>
                <Profile>all</Profile>
            </FirewallGroup>
        </FirewallGroups>
    </component>
    <component name="Microsoft-Windows-Deployment" 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">
        <RunSynchronous>           
              <RunSynchronousCommand wcm:action="add">
                  <Description>Enable administrator</Description>
                  <Order>1</Order>
                  <Path>net user administrator /active:yes</Path>
                  <WillReboot>OnRequest</WillReboot>
               </RunSynchronousCommand>
              <RunSynchronousCommand wcm:action="add">
                  <Description>finish</Description>
                  <Order>2</Order>
                  <Path>cmd /c echo cmd /c %windir%\System32\curl.exe "($FINISH)" >> %windir%\setup\scripts\SetupComplete.cmd</Path>
                  <WillReboot>OnRequest</WillReboot>
                </RunSynchronousCommand>
              <RunSynchronousCommand wcm:action="add">
                <Description>Delete route</Description>
                <Order>3</Order>
                <Path>cmd /c echo IF "($IPv4)"=="" (route delete 0.0.0.0/0) ELSE IF "($IPv6)"=="" (route delete ::/0) >> %windir%\setup\scripts\SetupComplete.cmd</Path>
                <WillReboot>OnRequest</WillReboot>
               </RunSynchronousCommand>
               <RunSynchronousCommand wcm:action="add">
                <Description>Setting multiple nameservers</Description>
                <Order>4</Order>
                <Path>cmd /c echo cmd /c %windir%\setup\scripts\nameservers.cmd ($NAMESERVERS) >> %windir%\setup\scripts\SetupComplete.cmd</Path>
                <WillReboot>OnRequest</WillReboot>
               </RunSynchronousCommand>
        </RunSynchronous>
    </component>
</settings>
    <cpi:offlineImage cpi:source="catalog:c:/distr/7601.17514.101119-1850_x64fre_server_eval_en-us-grmsxeval_en_dvd/sources/install_windows server 2008 r2 serverstandard.clg" xmlns:cpi="urn:schemas-microsoft-com:cpi" />
</unattend>

参考:

DCImanager 5 - Windows 11 英文企业90天试用版 - Unattend.xml

与之前的 Windows 10 做比较,是增加了跳过安装需求硬件检测,和添加网卡驱动inf目录路径。文件内容如下:

<?xml version="1.0" encoding="utf-8"?>
<unattend xmlns="urn:schemas-microsoft-com:unattend">
    <settings pass="windowsPE">
        <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">
                    <RunSynchronous>
                <RunSynchronousCommand wcm:action="add">
                    <Order>1</Order>
                    <Path>reg add HKLM\System\Setup\LabConfig /v BypassTPMCheck /t reg_dword /d 0x00000001 /f</Path>
                </RunSynchronousCommand>
                <RunSynchronousCommand wcm:action="add">
                    <Order>2</Order>
                    <Path>reg add HKLM\System\Setup\LabConfig /v BypassSecureBootCheck /t reg_dword /d 0x00000001 /f</Path>
                </RunSynchronousCommand>
                <RunSynchronousCommand wcm:action="add">
                    <Order>3</Order>
                    <Path>reg add HKLM\System\Setup\LabConfig /v BypassRAMCheck /t reg_dword /d 0x00000001 /f</Path>
                </RunSynchronousCommand>
                <RunSynchronousCommand wcm:action="add">
                    <Order>4</Order>
                    <Path>reg add HKLM\System\Setup\LabConfig /v BypassCPUCheck /t reg_dword /d 0x00000001 /f</Path>
                </RunSynchronousCommand>
                <RunSynchronousCommand wcm:action="add">
                    <Order>5</Order>
                    <Path>reg add HKLM\System\Setup\LabConfig /v BypassStorageCheck /t reg_dword /d 0x00000001 /f</Path>
                </RunSynchronousCommand>
            </RunSynchronous>
            <UserData>
                <AcceptEula>true</AcceptEula>
            </UserData>
         <DiskConfiguration>
                <WillShowUI>OnError</WillShowUI>
                <Disk wcm:action="add">
                    <CreatePartitions>
                        <CreatePartition wcm:action="add">
                            <Order>1</Order>
                            <Size>100</Size>
                            <Type>Primary</Type>
                        </CreatePartition>
                        <CreatePartition wcm:action="add">
                            <Extend>true</Extend>
                            <Order>2</Order>
                            <Type>Primary</Type>
                        </CreatePartition>
                    </CreatePartitions>
                    <ModifyPartitions>
                        <ModifyPartition wcm:action="add">
                            <Active>true</Active>
                            <Format>NTFS</Format>
                            <Label>System</Label>
                            <Order>1</Order>
                            <PartitionID>1</PartitionID>
                        </ModifyPartition>
                        <ModifyPartition wcm:action="add">
                            <Order>2</Order>
                            <PartitionID>2</PartitionID>
                            <Label>Windows</Label>
                            <Letter>C</Letter>
                            <Format>NTFS</Format>
                        </ModifyPartition>
                    </ModifyPartitions>
                    <DiskID>0</DiskID>
                    <WillWipeDisk>true</WillWipeDisk>
                </Disk>
            </DiskConfiguration>
            <ImageInstall>
                <OSImage>
                    <InstallTo>
                        <DiskID>0</DiskID>
                        <PartitionID>2</PartitionID>
                    </InstallTo>
                    <InstallFrom>
                        <MetaData wcm:action="add">
                            <Key>/IMAGE/INDEX</Key>
                            <Value>1</Value>
                        </MetaData>
                    </InstallFrom>
                    <WillShowUI>OnError</WillShowUI>
                    <InstallToAvailablePartition>false</InstallToAvailablePartition>
                </OSImage>
            </ImageInstall>
        </component>
        <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>0409:00000409</InputLocale>
            <SystemLocale>en-US</SystemLocale>
            <UILanguage>en-US</UILanguage>
            <UILanguageFallback>en-US</UILanguageFallback>
            <UserLocale>en-US</UserLocale>
            </component>
            
               <component name="Microsoft-Windows-PnpCustomizationsWinPE" 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">
            <DriverPaths>
                <PathAndCredentials wcm:action="add" wcm:keyValue="1">
                    <Path>c:\windows\ndis68</Path>
                </PathAndCredentials>
                <PathAndCredentials wcm:action="add" wcm:keyValue="2">
                    <Path>d:\windows\ndis68</Path>
                </PathAndCredentials>
                <PathAndCredentials wcm:action="add" wcm:keyValue="3">
                    <Path>x:\windows\ndis68</Path>
                </PathAndCredentials>
                <PathAndCredentials wcm:action="add" wcm:keyValue="4">
                    <Path>k:\windows\ndis68</Path>
                </PathAndCredentials>    
            </DriverPaths>            
            </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>
                <AdministratorPassword>
                    <Value>($PASS)</Value>
                </AdministratorPassword>
            </UserAccounts>
            <OOBE>
                <HideEULAPage>true</HideEULAPage>
            <SkipMachineOOBE>true</SkipMachineOOBE>
            <SkipUserOOBE>true</SkipUserOOBE>
            <HideOEMRegistrationScreen>true</HideOEMRegistrationScreen>
            <HideWirelessSetupInOOBE>true</HideWirelessSetupInOOBE>
        <ProtectYourPC>3</ProtectYourPC>
            </OOBE>
        </component>
        <component name="Microsoft-Windows-International-Core" 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">
            <InputLocale>en-US</InputLocale>
            <SystemLocale>en-US</SystemLocale>
            <UILanguage>en-US</UILanguage>
            <UserLocale>en-US</UserLocale>
        </component>
    </settings>

<settings pass="specialize">
    <component name="Microsoft-Windows-TCPIP" 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">
        <Interfaces>
            <Interface wcm:action="add">
                <Ipv4Settings>
                    <DhcpEnabled>false</DhcpEnabled>
                    <RouterDiscoveryEnabled>false</RouterDiscoveryEnabled>
                </Ipv4Settings>
                <Ipv6Settings>
                    <DhcpEnabled>false</DhcpEnabled>
                    <RouterDiscoveryEnabled>false</RouterDiscoveryEnabled>
                </Ipv6Settings>
                <Identifier>($WIN_MAC)</Identifier>
                <UnicastIpAddresses>
                    <IpAddress wcm:action="add" wcm:keyValue="1">($IP)/($NETMASK_SHORT)</IpAddress>
                    <IpAddress wcm:action="add" wcm:keyValue="2">($IPv6)/($NETMASKv6)</IpAddress>
                </UnicastIpAddresses>
                <Routes>
                    <Route wcm:action="add">
                        <Identifier>1</Identifier>
                        <Metric>10</Metric>
                        <NextHopAddress>($GATEWAYv4)</NextHopAddress>
                        <Prefix>0.0.0.0/0</Prefix>
                    </Route>
                    <Route wcm:action="add">
                        <Identifier>2</Identifier>
                        <Metric>10</Metric>
                        <NextHopAddress>($GATEWAYv6)</NextHopAddress>
                        <Prefix>::/0</Prefix>
                    </Route>
                </Routes>
            </Interface>
            <!--Interface wcm:action="add">
                <Ipv4Settings>
                    <DhcpEnabled>false</DhcpEnabled>
                    <RouterDiscoveryEnabled>false</RouterDiscoveryEnabled>
                </Ipv4Settings>
                <Ipv6Settings>
                    <DhcpEnabled>false</DhcpEnabled>
                    <RouterDiscoveryEnabled>false</RouterDiscoveryEnabled>
                </Ipv6Settings>
                <Identifier>Ethernet 2</Identifier>
            </Interface-->
        </Interfaces>
    </component>
    <component name="Microsoft-Windows-DNS-Client" 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">
        <Interfaces>
            <Interface wcm:action="add">
                <Identifier>($WIN_MAC)</Identifier>
                <DNSDomain>($HOSTNAME)</DNSDomain>
                <DNSServerSearchOrder>
                    <IpAddress wcm:action="add" wcm:keyValue="1">($NAMESERVER)</IpAddress>
                </DNSServerSearchOrder>
                <DisableDynamicUpdate>false</DisableDynamicUpdate>
                <EnableAdapterDomainNameRegistration>false</EnableAdapterDomainNameRegistration>
            </Interface>
        </Interfaces>
    </component>
    <component name="Microsoft-Windows-TerminalServices-LocalSessionManager" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS">
          <fDenyTSConnections>false</fDenyTSConnections>
      </component>
      <component name="Microsoft-Windows-TerminalServices-RDP-WinStationExtensions" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS">
          <UserAuthentication>0</UserAuthentication>
      </component>
    <component name="Networking-MPSSVC-Svc" 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">
        <FirewallGroups>
            <FirewallGroup wcm:action="add" wcm:keyValue="RemoteDesktop">
                <Active>true</Active>
                <Group>@FirewallAPI.dll,-28752</Group>
                <Profile>all</Profile>
            </FirewallGroup>
        </FirewallGroups>
    </component>
    <component name="Microsoft-Windows-Deployment" 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">
        <RunSynchronous>
           <RunSynchronousCommand wcm:action="add">
              <Description>Delete route</Description>
              <Order>1</Order>
              <Path>cmd /c echo IF "($IPv4)"=="" (route delete 0.0.0.0/0) ELSE IF "($IPv6)"=="" (route delete ::/0) >> %windir%\setup\scripts\SetupComplete.cmd</Path>
              <WillReboot>OnRequest</WillReboot>
           </RunSynchronousCommand>
           <RunSynchronousCommand wcm:action="add">
                       <Description>Disable Network Discovery</Description>
                       <Order>2</Order>
                       <Path>cmd /c echo cmd /c %windir%\System32\WindowsPowerShell\v1.0\powershell.exe -command "&amp; {&amp;'Disable-NetFirewallRule' –DisplayName '@FirewallAPI.dll,-32752'}" >> %windir%\setup\scripts\SetupComplete.cmd</Path>
                       <WillReboot>OnRequest</WillReboot>
           </RunSynchronousCommand>
                   <RunSynchronousCommand wcm:action="add">
                       <Description>Setting multiple nameservers</Description>
                       <Order>3</Order>
                       <Path>cmd /c echo cmd /c %windir%\setup\scripts\nameservers.cmd ($NAMESERVERS) >> %windir%\setup\scripts\SetupComplete.cmd</Path>
                       <WillReboot>OnRequest</WillReboot>
                   </RunSynchronousCommand>
           <RunSynchronousCommand wcm:action="add">
                       <Description>Enable language</Description>
                       <Order>4</Order>
                       <Path>cmd /c %windir%\System32\WindowsPowerShell\v1.0\powershell.exe %windir%\setup\scripts\lang.ps1 "($LANG)" >>%windir%\setup\scripts\lang.log 2>&amp;1</Path>
                       <WillReboot>Never</WillReboot>
                   </RunSynchronousCommand>
           <RunSynchronousCommand wcm:action="add">
              <Description>finish</Description>
              <Order>5</Order>
                      <Path>cmd /c echo cmd /c %windir%\setup\scripts\wget.exe -O- "($FINISH)" >> %windir%\setup\scripts\SetupComplete.cmd</Path>
              <WillReboot>OnRequest</WillReboot>
           </RunSynchronousCommand>
           <RunSynchronousCommand wcm:action="add">
                      <Description>Postinstall script listener</Description>
                      <Order>6</Order>
                      <Path>cmd /c IF "($HAS_RECIPE)"=="1" (echo cmd /c %windir%\System32\WindowsPowerShell\v1.0\powershell.exe  %windir%\setup\scripts\winrm_listener.ps1 "($HOSTNAME)" "($LOCATIONIP)") >> %windir%\setup\scripts\SetupComplete.cmd</Path>
                      <WillReboot>OnRequest</WillReboot>
                   </RunSynchronousCommand>
                   <RunSynchronousCommand wcm:action="add">
                       <Description>Put key</Description>
                       <Order>7</Order>
                       <Path>cmd /c echo ($PRODUCTKEY) >> %windir%\setup\key</Path>
                       <WillReboot>OnRequest</WillReboot>
                   </RunSynchronousCommand>
                   <RunSynchronousCommand wcm:action="add">
                       <Description>Activating windows</Description>
                       <Order>8</Order>
                       <Path>cmd /c echo cmd /c %windir%\setup\scripts\activate.cmd >> %windir%\setup\scripts\SetupComplete.cmd</Path>
                       <WillReboot>OnRequest</WillReboot>
                   </RunSynchronousCommand>
                   <RunSynchronousCommand wcm:action="add">
                       <Description>TZ setup</Description>
                       <Order>9</Order>
                       <Path>cmd /c IF NOT "($TIMEZONE)" == "()" ( IF NOT "($TIMEZONE)" == "" (tzutil /s "($TIMEZONE)"))</Path>
                       <WillReboot>OnRequest</WillReboot>
                   </RunSynchronousCommand>
           <RunSynchronousCommand wcm:action="add">
                  <Description>Enable administrator</Description>
                  <Order>10</Order>
                  <Path>net user administrator /active:yes</Path>
                  <WillReboot>OnRequest</WillReboot>
               </RunSynchronousCommand>
        </RunSynchronous>
    </component>
</settings>
    <cpi:offlineImage cpi:source="catalog:c:/distr/7601.17514.101119-1850_x64fre_server_eval_en-us-grmsxeval_en_dvd/sources/install_windows server 2008 r2 serverstandard.clg" xmlns:cpi="urn:schemas-microsoft-com:cpi" />
</unattend>

参考:

使用 grub4dos 来引导硬盘上的 grml.iso livecd - debian

需求:将 LiveCD grml.iso 保存在 ntfs 分区上,使用 grub4dos 来引导,加载 grml.iso 文件。

本例,硬盘是 MBR 分区,只有一个 NTFS 分区,已经安装有 Windows 22H2。grml.iso 保存在 C:\iso\grml.iso。

尝试:

  1. 先安装 grub4dos, 将 grub4dos ,用 bcdedit 将 grub4dos 添加到启动菜单中
  2. 这里的 C:\menu.lst 文件内容,其中 findiso 参数是让它能在设备中查找iso文件,toram=grml.squashfs 是避免 ntfs-3g 自动将 ntfs 分区挂载为“可读写”,导致重启或关机时会挂死

    title grml
    find --set-root --ignore-floppies --ignore-cd /iso/grml.iso
    map /iso/grml.iso (0xff)
    map --hook
    set opts=" toram=grml.squashfs dns=8.8.8.8 ip=192.168.1.108::192.168.1.1:255.255.255.0:testbox:eth0:off ssh=mima "
    kernel (0xff)/boot/grml/vmlinuz apm=power-off boot=live live-media-path=/live/grml/ bootid=grml001 findiso=/iso/grml.iso  nomce net.ifnames=0 %opts%
    initrd (0xff)/boot/grml/initrd.img
    map --unhook
    boot
    savedefault --wait=2

参考:

testdisk 恢复磁盘分区后无法进入系统 - 1234F: - 错误

现象:一台机子,在 fdisk 里查看,没有分区。尝试使用 testdisk,盲猜是 gpt 分区类型,自动分析出有三个分区。写入、保存磁盘分区信息后,机子无法自动引导到操作系统,提示 1234F:

尝试:估计磁盘的原有分区是 mbr ,并不是 gpt ,因为里边没有 EFI 分区,且原系统中,没有 efi 相关的文件。然后再次运行 testdisk ,将分区信息保存为 mbr 。再次重启机子,依然是 1234F: ,无法引导系统。最后,在急救系统里,grub-install 到磁盘,重新安装 grub 。之后,就可以看到 grub 的引导信息,顺利进入到 debian 系统了。

参考:

在 FreeBSD 13.2 里尝试安装 iRedMail 1.6.8 - 放弃

原因:看到 iRedMail 群里有人说在 FreeBSD 13.2 里安装出错,提示如:

lsof-4.99.3_1,8 requires kernel sources.
error code 1
stop.
make stopped in /usr/ports/sysutils/lsof
error code 1
stop
make stooped to /usr/ports/devel/py-Jinjia2
error failed to downloading package, please fix it manually and then relaunch iRedMail installer.

我在一台国外的机子,配置是 Atom C2750, 8GB 内存里测试 iRedMail 的安装。遇到同样的报错信息。虽然可以手工下载 ftp://ftp.freebsd.org/pub/FreeBSD/releases/amd64/13.2-RELEASE/src.txz 后继续安装,但通过 ports 编译软件,所需的时间太长了。过了约24小时,还没完成,当前界面信息停留在:

l' -Cprefer-dynamic -Z binary-dep-depinfo -L native=/usr/ports/lang/rust/work/_build/x86_64-unknown-freebsd/stage0-rustc/x86_64-unknown-freebsd/release/build/psm-d1aad399e5dbb6f5/out -L native=/usr/ports/lang/rust/work/_build/x86_64-unknown-freebsd/stage0-rustc/x86_64-unknown-freebsd/release/build/rustc_llvm-938455d976a8c95f/out -L native=/usr/ports/lang/rust/work/_build/x86_64-unknown-freebsd/llvm/build/lib`
    Building [=======================> ] 316/323: rustc_driver_impl

但我不想等待结果,放弃了。

-- Build files have been written to: /usr/ports/lang/rust/work/_build/x86_64-unknown-freebsd/lld/build
running: cd "/usr/ports/lang/rust/work/_build/x86_64-unknown-freebsd/lld/build" && DESTDIR="" "cmake" "--build" "." "--target" "install" "--config" "Release" "--" "-j" "1"
[  1% 3/127] Building CXX object Common/CMakeFiles/lldCommon.dir/CommonLinkerContext.cpp.o^C
ninja: build stopped: interrupted by user.

Build completed unsuccessfully in 14:46:49
*** Error code 1
*** Signal 2

参考: