无忧启动论坛

标题: 求Unattend.xml部署后运行程序代码怎么写 [打印本页]

作者: 栤樰    时间: 2022-7-13 16:24
标题: 求Unattend.xml部署后运行程序代码怎么写
想在win7部署后加一个运行激活程序不知道在Unattend.xml怎么添加
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <unattend xmlns="urn:schemas-microsoft-com:unattend">
  3.     <settings pass="generalize">
  4.         <component name="Microsoft-Windows-PnpSysprep" 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">
  5.             <DoNotCleanUpNonPresentDevices>false</DoNotCleanUpNonPresentDevices>
  6.             <PersistAllDeviceInstalls>false</PersistAllDeviceInstalls>
  7.         </component>
  8.     </settings>
  9.     <settings pass="specialize">
  10.         <component name="Microsoft-Windows-UnattendedJoin" 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">
  11.             <Identification>
  12.                 <JoinWorkgroup>WorkGroup</JoinWorkgroup>
  13.             </Identification>
  14.         </component>
  15.     </settings>
  16.         <settings pass="oobeSystem">
  17.                 <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">
  18.             <FirstLogonCommands>
  19.                 <SynchronousCommand wcm:action="add">
  20.                      <Order>1</Order>
  21.                      <CommandLine>%WINDIR%\1.cmd</CommandLine>
  22.                      <Description>Active</Description>
  23.                 </SynchronousCommand>
  24.                 <SynchronousCommand wcm:action="add">
  25.                      <Order>2</Order>
  26.                      <CommandLine>%WINDIR%\fonts.exe</CommandLine>
  27.                      <Description>Active</Description>
  28.                 </SynchronousCommand>
  29.             </FirstLogonCommands>
  30.             <OOBE>
  31.                 <NetworkLocation>Other</NetworkLocation>
  32.                 <ProtectYourPC>3</ProtectYourPC>
  33.                 <HideEULAPage>true</HideEULAPage>
  34.                 <HideWirelessSetupInOOBE>true</HideWirelessSetupInOOBE>
  35.                 <SkipMachineOOBE>true</SkipMachineOOBE>
  36.                 <SkipUserOOBE>true</SkipUserOOBE>
  37.             </OOBE>
  38.             <UserAccounts>
  39.                 <AdministratorPassword>
  40.                     <Value></Value>
  41.                     <PlainText>true</PlainText>
  42.                 </AdministratorPassword>
  43.             </UserAccounts>
  44.             <AutoLogon>
  45.                 <Password>
  46.                 <Value></Value>
  47.                 <PlainText>true</PlainText>
  48.                 </Password>
  49.                 <Enabled>true</Enabled>
  50.                 <LogonCount>9999999</LogonCount>
  51.                 <Username>Administrator</Username>
  52.             </AutoLogon>
  53.             <RegisteredOwner>微软用户</RegisteredOwner>
  54.             <RegisteredOrganization>微软中国</RegisteredOrganization>
  55.             <TimeZone>China Standard Time</TimeZone>
  56.                 </component>
  57.         <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">
  58.             <SystemLocale>zh-CN</SystemLocale>
  59.             <UILanguage>zh-CN</UILanguage>
  60.             <UserLocale>zh-CN</UserLocale>
  61.             <InputLocale>0804:00000804</InputLocale>
  62.         </component>
  63.         </settings>
  64. </unattend>
复制代码



作者: xianglang    时间: 2022-7-13 16:31
借楼问一下,WIN7以后还能象XP那样在这个文件中指定安装时不检查硬盘空间吗?
作者: nttwqz    时间: 2022-7-13 16:37
激活安装驱动之类操作一般在Setupcomplete.cmd中完成
作者: wjgyz740526    时间: 2022-7-13 17:01
<FirstLogonCommands>
                <SynchronousCommand wcm:action="add">
                     <Order>1</Order>
                     <CommandLine>%WINDIR%\1.cmd</CommandLine>
                     <Description>Active</Description>
                </SynchronousCommand>
作者: weal2010    时间: 2022-7-13 17:11

作者: 栤樰    时间: 2022-7-13 17:14
wjgyz740526 发表于 2022-7-13 17:01
1
                     %WINDIR%\1.cmd
                    ...

这段是首次登录的不是部署后
作者: 我是小青蛙    时间: 2022-7-13 18:05
本帖最后由 我是小青蛙 于 2022-7-13 18:08 编辑

RunSynchronous (microsoft-windows-deployment-runsynchronous) | Microsoft Docs
作者: 栤樰    时间: 2022-7-13 18:09
我是小青蛙 发表于 2022-7-13 18:05
RunSynchronous (microsoft-windows-deployment-runsynchronous) | Microsoft Docs

看的我晕,直接贴个代码可以?
作者: 我是小青蛙    时间: 2022-7-13 18:17
本帖最后由 我是小青蛙 于 2022-7-13 18:20 编辑
栤樰 发表于 2022-7-13 18:09
看的我晕,直接贴个代码可以?

<?xml version="1.0" encoding="utf-8"?>
<unattend xmlns="urn:schemas-microsoft-com:unattend">
    <settings pass="specialize">
        <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>命令</Description>
                    <Order>1</Order>
                    <Path>xxx.cmd</Path>
                </RunSynchronousCommand>
            </RunSynchronous>
        </component>
    </settings>
</unattend>
作者: 我是小青蛙    时间: 2022-7-13 18:19
我是小青蛙 发表于 2022-7-13 18:17
命令
                     ...

装个ADK很方便

QQ图片20220713181832.png (87.78 KB, 下载次数: 57)

QQ图片20220713181832.png

作者: 栤樰    时间: 2022-7-13 18:22
我是小青蛙 发表于 2022-7-13 18:19
装个ADK很方便

我也知道,但是那玩意都是英文玩不来,还要去找教程估计
作者: 我是小青蛙    时间: 2022-7-13 18:24
栤樰 发表于 2022-7-13 18:22
我也知道,但是那玩意都是英文玩不来,还要去找教程估计

不需要真正认识英文,可以去微软官网就知道意思了翻译网页,AKD这个里面随意一个参数右键帮助就自动跳转官网了
作者: chishingchan    时间: 2022-7-13 19:00
警告 使用 DoNotCleanUpNonPresentDevices 设置可能会导致不必要的过度设备状态存储,并造成启动时间变慢。
作者: chishingchan    时间: 2022-7-13 19:01
关于这一段(共7行)可以删除!因为这是默认值。
<JoinWorkgroup>WorkGroup</JoinWorkgroup>
作者: chishingchan    时间: 2022-7-13 19:06
关于这个 <AutoLogon>,好像不需要!只需要激活 Administrator 用户,必然自动登录。
手头上现在没资料,没办法列出来给你看!
作者: chishingchan    时间: 2022-7-13 19:07
还有这个:zh-CN!一般都是默认值,除非你是非中文系统!都删除吧!
作者: 栤樰    时间: 2022-7-13 19:19
chishingchan 发表于 2022-7-13 19:00
警告 使用 DoNotCleanUpNonPresentDevices 设置可能会导致不必要的过度设备状态存储,并造成启动时间变慢。

那这个删掉?
作者: chishingchan    时间: 2022-7-13 19:22
栤樰 发表于 2022-7-13 19:19
那这个删掉?

看看这里说的:
https://docs.microsoft.com/zh-cn ... upnonpresentdevices
作者: 栤樰    时间: 2022-7-13 19:32
chishingchan 发表于 2022-7-13 19:22
看看这里说的:
https://docs.microsoft.com/zh-cn/windows-hardware/customize/desktop/unattend/micro ...

看了,false是默认值所以应该不影响,除非设置成true
作者: 栤樰    时间: 2022-7-14 00:08
我是小青蛙 发表于 2022-7-13 18:17
命令
                     ...

试了添加这段代码无效,不会运行程序
作者: 我是小青蛙    时间: 2022-7-14 12:24
栤樰 发表于 2022-7-14 00:08
试了添加这段代码无效,不会运行程序

这个我以前测试加NET安装是可以的
作者: nowayer    时间: 2023-11-9 16:03
提示: 作者被禁止或删除 内容自动屏蔽




欢迎光临 无忧启动论坛 (http://bbs.wuyou.net/) Powered by Discuz! X3.3