我的理解是,Oracle默认的Windows服务器映像利用Cloudbase-Init与Unattend.xml文件一起为用户生成密码,但我很好奇这方面的具体情况,因为我试图用预装的软件创建自己的映像。我想要生成一个随机密码,并明确不要求用户更改它。尽管如此,这里是我尝试过的部分(我只包含了Unattend.xml文件的泛化部分):
尝试#1
在我的第一次尝试中,我尽我所能(尽我所知)去模仿默认的图像。这与使用Oracle的默认Windows2019标准映像从通用实例中提取的未出席配置文件和cloubase配置文件相同。使用这些时,会提示用户在登录时更改密码。
Unattend.xml
<settings pass="generalize">
<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">
<PersistAllDeviceInstalls>true</PersistAllDeviceInstalls>
</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">
<Order>1</Order>
<Path>cmd.exe /c ""c:\Program Files\Cloudbase Solutions\Cloudbase-Init\Python\Scripts\cloudbase-init.exe" --config-file "c:\Program Files\Cloudbase Solutions\Cloudbase-Init\conf\cloudbase-init-unattend.conf" && exit 1 || exit 2"</Path>
<Description>Run Cloudbase-Init to set the hostname</Description>
<WillReboot>OnRequest</WillReboot>
</RunSynchronousCommand>
</RunSynchronous>
</component>
</settings>cloudbase-init-unattend.conf
[DEFAULT]
username=opc
groups=Administrators
bsdtar_path=C:\Program Files\Cloudbase Solutions\Cloudbase-Init\bin\bsdtar.exe
mtools_path=C:\Program Files\Cloudbase Solutions\Cloudbase-Init\bin\
verbose=true
debug=true
logdir=C:\Program Files\Cloudbase Solutions\Cloudbase-Init\log\
logfile=cloudbase-init-unattend.log
default_log_levels=comtypes=INFO,suds=INFO,iso8601=WARN,requests=WARN
logging_serial_port_settings=COM1,9600,N,8
local_scripts_path=C:\Program Files\Cloudbase Solutions\Cloudbase-Init\LocalScripts\
metadata_services=cloudbaseinit.metadata.services.httpservice.HttpService
plugins=cloudbaseinit.plugins.windows.winrmlistener.ConfigWinRMListenerPlugin,cloudbaseinit.plugins.common.userdata.UserDataPlugin
allow_reboot=false
stop_service_on_exit=false
check_latest_version=false尝试#2
在我的第二次尝试中,我尝试将一个命令添加到user文件中,该命令将导致用户不会被提示更改他们的密码。我使用了与尝试#1相同的cloubase配置文件。在推广之后,用户仍然会被提示选择一个新密码。
Unattend.xml
<settings pass="generalize">
<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">
<PersistAllDeviceInstalls>true</PersistAllDeviceInstalls>
</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">
<Order>1</Order>
<Path>cmd.exe /c "net user opc /logonpasswordchg:no && exit 1 || exit 2</Path>
<Description>Ensure the opc user does not have to reset their password</Description>
<WillReboot>Never</WillReboot>
</RunSynchronousCommand>
<RunSynchronousCommand wcm:action="add">
<Order>2</Order>
<Path>cmd.exe /c ""c:\Program Files\Cloudbase Solutions\Cloudbase-Init\Python\Scripts\cloudbase-init.exe" --config-file "c:\Program Files\Cloudbase Solutions\Cloudbase-Init\conf\cloudbase-init-unattend.conf" && exit 1 || exit 2"</Path>
<Description>Run Cloudbase-Init to set the hostname</Description>
<WillReboot>OnRequest</WillReboot>
</RunSynchronousCommand>
</RunSynchronous>
</component>
</settings>尝试#3
在我的第三次尝试中,我更改了user文件中命令的顺序,这样在处理cloudbase init配置之后,网络用户被告知在登录时不要更改他们的密码。我再次使用了与尝试#1和#2相同的cloubase配置文件。推广之后,用户仍然会被提示选择一个新密码。
Unattend.xml
<settings pass="generalize">
<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">
<PersistAllDeviceInstalls>true</PersistAllDeviceInstalls>
</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">
<Order>1</Order>
<Path>cmd.exe /c ""c:\Program Files\Cloudbase Solutions\Cloudbase-Init\Python\Scripts\cloudbase-init.exe" --config-file "c:\Program Files\Cloudbase Solutions\Cloudbase-Init\conf\cloudbase-init-unattend.conf" && exit 1 || exit 2"</Path>
<Description>Run Cloudbase-Init to set the hostname</Description>
<WillReboot>OnRequest</WillReboot>
</RunSynchronousCommand>
<RunSynchronousCommand wcm:action="add">
<Order>2</Order>
<Path>cmd.exe /c "net user opc /logonpasswordchg:no && exit 1 || exit 2</Path>
<Description>Ensure the opc user does not have to reset their password</Description>
<WillReboot>Never</WillReboot>
</RunSynchronousCommand>
</RunSynchronous>
</component>
</settings>这些方法都没有取得我想要的结果。我还尝试使用Cloudbase中的一个插件--Init来生成密码,但似乎Oracle Cloud Agent完全无法通过RDP登录,因为我完全无法通过RDP登录,而如果不使用Cloudbase插件,我可以登录,但在设置新密码之前无法访问桌面。
这就引出了一个问题:什么在这里不起作用?这是一个配置问题,还是我从根本上误解了这个过程的工作方式?
我将感谢任何人可能提出的任何建议,或其他人创建的示例实现。谢谢!
发布于 2020-05-02 18:52:09
虽然我无法让Unattend.xml文件自动运行我的命令,但最简单的解决方案是使用Cloudbase-Init用户数据来提供我的命令。最终的userdata脚本看起来如下所示:
rem cmd
net user opc /logonpasswordchg:no我希望这对将来发现这个问题的人有帮助。
https://stackoverflow.com/questions/61509767
复制相似问题