当前位置:网站首页>Cloudbase init considerations

Cloudbase init considerations

2022-06-23 20:30:00 shawyang

UserData Product documentation :https://cloud.tencent.com/document/product/213/17526

UserData rely on cloudbase-init,cloudbase-init Optical drive dependent , Please do not disable cloudbase-init Service or change it 、 Do not disable the optical drive , Do not delete the drive letter , If you have security software , May intercept cloudbase-init, because cloudbase-init adopt python Work , Security software may think this is a risk item , Therefore, it is necessary to do so in the security software cloudbase-init The trust of the .

cloudbase-init Very important ,cloudbase-init Can users delete ? Reference resources https://cloud.tencent.com/developer/article/1883449

powershell Automated reloading cloudbase-init by 1.1.2 edition

https://cloud.tencent.com/developer/article/1940021

There are many precautions , Be sure to read it carefully

① Don't ban it cloudbase-init service , Do not disable the CD-ROM drive , This will affect initialization 、 Set the password 、 Set up hostname Etc

② Please trust in the security software cloudbase-init, otherwise , Security software will intercept cloudbase-init, Lead to cloudbase-init Related functional exceptions , For example, resetting the password failed , Even in security software , Should also be separately in cmd Command line and powershell Command line execution net user Administrator " password " Several times , Ensure that the security software does not intercept ; because cloudbase-init Itself is python Source code , It's through cmd.exe and powershell.exe call net user Administrator " password " Orders work , therefore cloudbase-init Related executable files such as C:\Program Files\Cloudbase Solutions\Cloudbase-Init\Python\Scripts In the directory .exe file 、cmd.exe、powershell.exe、net.exe、net1.exe(net1.exe It is the command of the operating system , Don't feel like a Trojan horse , The first time I saw this command , There is also this illusion ) If the executable file is blocked by the security software, the password setting will be affected , The security software has to release these executables . perhaps There is a problem with the environment variables so that these commands cannot be used in cmd Command line or powershell The command line directly recognizes , It can also lead to problems , Or the customer has installed a set python Added environment variables , and cloudbase-init I brought my own set python It's just cloudbase-init In the installation directory of , If python There is a problem with the environment variables , It may also affect cloudbase-init Normal execution .

The environment variables in the above figure cannot be recognized normally net command , I changed the order , hold %SystemRoot% Transfer to %SystemRoot%\system32 The above

Because I thought %SystemRoot%\system32 The premise is to recognize %SystemRoot%, So the %SystemRoot% Tune it up , And then it's back to normal

③ Please do not turn off password complexity in group policy , Bear in mind !!! Query whether the password complexity is enabled through the command , And set to close / Open password complexity , Reference resources https://cloud.tencent.com/developer/article/1883630

④cloudbase-init Please select the local system account (LocalSystem), Don't choose .\cloudbase-init

⑤userdata If the pipeline outputs .ps1 file , Please explicitly limit the maximum number of characters in the line of the file , such as { # Do not exceed lines of code 1023 Characters exit 2>$null } | Out-File "c:\chromesetup.ps1" -Width 1024 2>$null 1>$null

Please do not rush to log in with the new password when the password display is running just after the console is reset , Please at least wait 1 Minutes or so before operation ( front 10 The user name or password error will be reported within seconds , The reason is password reset 2 Step , The first 1 The next step is to issue instructions from the console , The first 2 Step 1 is to pass the command after startup cloudbase-init The service call powershell perform ), This phenomenon is inevitable in some special images , Basically, after setting the password 3 Minutes or more before it takes effect

⑦ Please don't delete cloudbase-init The registry , If a message is passed when the machine is created userdata, and userdata There is code for writing operations in the code , So you deleted cloudbase-init The registry of causes initialization to be marked as 0, The next time I turn on cloudbase-init You will think that the machine has not been initialized , It's a new machine , It will automatically trigger the re execution userdata Code in , The severity assumption , Suppose there is an operation to format the data disk in the code , Don't you want to be cool

But if your original machine is not used userdata, It is recommended to do a custom image , As administrator in powershell Execute this command , Otherwise, when the system is reinstalled to the original machine with the produced image , If you specify a new password that is different from the original one , The new password is not valid .

reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Cloudbase Solutions" /f 2>&1 > $null

⑧ Blackstone cloudbase-init It is specially configured , With the common cvm A little difference between , Blackstone cloudbase-init Please don't move

⑨ Newly purchased machines hostname Not fully effective , You need to restart the machine to take effect , If you want to automate , Need to be in userdata Riga restart code , You can also modify cloudbase-init In the configuration file allow_reboot The parameter values are from false Change it to true, This will automatically restart after buying a new machine , This point has been fed back to Tencent cloud , I have verified that some regions have taken effect ⑩ Before making an image , Please make sure that the original machine is not used when it is created userdata, And then as an administrator in powershell Execute the following code reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Cloudbase Solutions" /f 2>&1 > $null reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkList\Profiles" /f 2>&1 > $null reg add "HKLM\SYSTEM\CurrentControlSet\Control\Network\NewNetworkWindowOff" /f 2>&1 > $null wevtutil el | Foreach-Object {wevtutil cl "$_" 2>$null} wevtutil cl security 2>$null wevtutil cl system 2>$null

原网站

版权声明
本文为[shawyang]所创,转载请带上原文链接,感谢
https://yzsam.com/2021/12/202112311238398858.html