温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

SCVMM 2012 R2 及应答文件BUG解决

发布时间:2020-06-14 21:18:13 来源:网络 阅读:1410 作者:yoke88 栏目:系统运维

背景:

1. 计划使用SCVMM 2012 R2自动部署win7 虚拟机模板,VM模板虽然已经使用过很多次,但是客户端版的OS和服务器端的OS版有一点不一样,那就是客户端版的操作系统会默认禁用administrator 账号,然后必须新建一个管理员账号。

2. 计划使用SCVMM VM 模板中的应答文件来用Unattend.xml 来默认启用一些设置(如防火墙默认开通远程桌面,开启默认管理员并设置密码),自动登录一次默认管理员,然后执行一些命令,如配置启动菜单(VM崩溃时好像会进入恢复模式,这样VM重启时需要人工介入),其他配置一些服务之类的操作。

 

问题: SCVMM 里这个Win7的指定管理员账号时,不能使用administrator ,否则部署时会报错(10619,所提供的用户名不是有效的该操作系统的本地管理员名称)。

当你配置其他的账号名称时,SCVMM在unattend.xml 中生成一段OOBE阶段的创建本地账号的设置,如果使用administrator 那么会和现有的administrator 冲突吧(但是奇怪的是我在对server VM 的模板上都是这样用的,只有client 版本的有这样的问题)。

SCVMM 2012 R2 及应答文件BUG解决

问题2:由于问题1 ,那么我这里建立的admin的账号,我希望在VM部署后自动被删掉。上图的GUIRunonce的部分似乎可以做这个工作,但是问题在于GUIRunonce需要登录一个账号,那么解决的话要自动登录默认administrator账号一次,然后执行一些默认命令如net user admin /del .

 

BUG 呈现:虽然以上想法在原理上没有问题,而且我也拿unattend.xml 直接在hyper-v VM 测试下了下没有问题,但是在用SCVMM时却出了BUG。

1. 现象1 ,如果你再unattend.xml 中配置了autologon ,而且配置了logoncount ,那么SCVMM最后生成合并的unattend.xml中,logonCount 会变成999次,意味着你必须还要其他手段来清除autologon,否则这个VM一直自动登录。

2.现象2,如果你再unattend.xml 中配置了autologon 而且同时在SCVMM 中指定了 GUIRunOnce命令,那么这个GUIRunOnce的命令在最后合成的unattend.xml 变成空白,就算你不在SCVMM的GUIRunOnce窗口中配这些命令,而是直接写在应答文件里,SCVMM 最后合并时也会把这些命令给变成空的。

 

下面是问题XML,而且在微软的论坛中也有人提到这个BUG,似乎年代很久远了,但是我最新的2012 r2 的版本还是问题依旧。

https://social.technet.microsoft.com/Forums/systemcenter/en-US/de874b1b-bd93-4746-a138-22422ff3717c/unattendxml-parsingmerging-issue-with-scvmm-2012-r2?forum=virtualmachinemanager

 

SCVMM 2012 R2 及应答文件BUG解决

 

思考及解决:

1. 如果是autologon 导致的BUG,那么能否绕过这个部分,不用登录账号执行命令。有的,windows 部署完在第一次登录账号前,可以配置一个自定义脚本来执行命令,脚本名称固定为setupComplete.cmd,脚本路径在%WINDIR%\Setup\Scripts\SetupComplete.cmd, 我们只需要创建修改这个脚本即可了。

参考:

https://technet.microsoft.com/en-us/library/cc766314(v=ws.10).aspx 

 

成品SCVMM 中用的Unattend.xml(针对32位win7),64位的win7 ,修改下processorArchitecture="x86" 中的x86 位x64,就可以了:

备注信息:XML中的产品序列号为KMS Client Key。默认开启远程桌面及远程桌面对应的防火墙。默认启用administrator 账号,administrator 账号的密码部分是加密后的值,你可以在windows system image manager 中来更改加密的密码(输入的时候明文,写出的是加密的密文)

<?xml version="1.0" encoding="utf-8"?>
<unattend xmlns="urn:schemas-microsoft-com:unattend">
    <settings pass="specialize">
        <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="x86" 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>
            <RegisteredOwner></RegisteredOwner>
            <ShowWindowsLive>false</ShowWindowsLive>
            <RegisteredOrganization></RegisteredOrganization>
            <ProductKey>FJ82H-XT6CR-J8D7P-XQJJ2-GPDD4</ProductKey>
        </component>
        <component name="Microsoft-Windows-TerminalServices-LocalSessionManager" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
            <fDenyTSConnections>false</fDenyTSConnections>
        </component>
        <component name="Microsoft-Windows-TerminalServices-RDP-WinStationExtensions" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
            <SecurityLayer>1</SecurityLayer>
            <UserAuthentication>0</UserAuthentication>
        </component>
        <component name="Networking-MPSSVC-Svc" processorArchitecture="x86" 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-UnattendedJoin" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
            <Identification>
                <JoinWorkgroup>WORKGROUP</JoinWorkgroup>
            </Identification>
        </component>
        <component name="Microsoft-Windows-Deployment" processorArchitecture="x86" 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>net user administrator /active:yes</Path>
                </RunSynchronousCommand>
            </RunSynchronous>
        </component>
    </settings>
    <settings pass="oobeSystem">
        <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
            <OOBE>
                <HideEULAPage>true</HideEULAPage>
                <ProtectYourPC>1</ProtectYourPC>
                <NetworkLocation>Work</NetworkLocation>
            </OOBE>
            <RegisteredOrganization>microsoft</RegisteredOrganization>
            <RegisteredOwner>microsoft</RegisteredOwner>
            <TimeZone>China Standard Time</TimeZone>
            <UserAccounts>
                <AdministratorPassword>
                    <Value>Password Here ==</Value>
                    <PlainText>false</PlainText>
                </AdministratorPassword>
            </UserAccounts>
        </component>
        <component name="Microsoft-Windows-International-Core" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
            <UserLocale>zh-CN</UserLocale>
            <UILanguageFallback></UILanguageFallback>
            <UILanguage>zh-CN</UILanguage>
            <SystemLocale>zh-CN</SystemLocale>
            <InputLocale>0804:00000804</InputLocale>
        </component>
    </settings>
</unattend>

 

成品 setupComplete.cmd:

@echo off

net user admin /del

bcdedit /set {default} recoveryenabled No

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI