标签 windows 下的文章

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>

参考:

在 virtualizor 创建 Windows系统模板

步骤:

  1. 创建VPS,磁盘至少20GB
  2. 在救援模式,通过dd的命令,安装好Windows 2022,确认可以正常远程桌面连接
  3. 关闭Windows系统。尝试通过 virtualizor 面板创建Windows模板,但长时间等待后,仅是创建了0大小的文件,操作失败
  4. 按教程里,登录到vps所在的节点,用命令 /usr/local/virtualizor/tools/windows.php 创建Windows模板,得到一个约13GB的img文件,命名为example-windows.img。再将该img文件复制到主控的 /var/virtualizor/kvm 目录里
  5. 再在 virutalizor 面板里添加模板,URL 就写文件的位置 /var/virtualizor/kvm/example-windows.img

参考:https://www.virtualizor.com/docs/admin/create-os-template/

Windows 10 从19xx自动更新到 20H2

之前,时不时提示因为某个原因,更新没有成功安装。打开提示信息对话框,原来是说VMware Player不兼容,需要卸载。我都忘记这个VMware Player具体是什么版本,好久没使用了。卸载VMware Player后,在日常使用截图保存图片时,发现常保存的一个路径提示不存在,联想到之前有人反馈Windows更新会让某些目录不可以访问,我就由得它,等等再说。隔天,图片的路径果然可以访问了,文件没丢。如果每次只是点击“关机”的话,Windows不会更新的。选择“更新并重启”会安装更新,好像花了三十分钟左右,安装了更新,桌面默认的壁纸从原先的深蓝变成了天蓝。

dn_vm-player-1.png

Windows系统自动执行脚本的方法

问题:假设一个Windows 2016系统,设置了静态IP,在没有IPMI远程管理工具的情况下,如果改成新的IP?

尝试:

  1. 从急救系统,如 SystemRescueCd 启动机子
  2. 用 chntpw 工具修改注册表。新增Runonce启动项,设置自动登录账户(DefaultUserName,AutoAdminLogon 和 DefaultPassword 的键值)
  3. 用 ntfs-3g 往Windows目录里添加启动时要运行的脚本
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run

参考:

用 dism 更换 Windows 2016 的版本

  1. slmgr -xpr # 尝试查看当前的激活信息。出错:Error: 0xC004F069 On a computer running Microsoft Windows non-core edition, run 'slui.exe 0x2a 0xC004F069' to display the error text.
  2. slui.exe 0x2a 0xC004F069 # 查看具体的错误信息,You can also contact Microsoft by phone to help resolve this problem.[Expanded Information]Code:0xC004F069 Description:The Software Licensing Service reported that the product SKU is not found.
  3. DISM.exe /Online /Get-TargetEditions # 查看可以升级到哪个版本
  4. DISM /online /Set-Edition:ServerDatacenter /ProductKey:CB7KF-BWN84-R7R2Y-793K2-8XDDG /AcceptEula # 本例是升级到 ServerDatacenter 版本
C:\Users\Administrator> DISM /online /Set-Edition:ServerDatacenter /ProductKey:CB7KF-BWN84-R7R2Y-793K2-8XDDG /AcceptEula

Deployment Image Servicing and Management tool
Version: 10.0.14393.0

Image Version: 10.0.14393.0

Starting to update components...
Starting to install product key...
Finished installing product key.

Removing package Microsoft-Windows-ServerDatacenterEvalEdition~31bfd364e35~amd64~~10.0.14393.0
[==========================100.0%==========================]
Finished updating components.

Starting to apply edition-specific settings...
Restart Windows to complete this operation.
Do you want to restart the computer now? (Y/N)

参考: