用开机计划任务调用devcon.exe禁用腾讯云光驱和High Definition Audio Device
devcon的用法参考:https://cloud.tencent.com/developer/article/2364580
powershell禁用腾讯云光驱和High Definition Audio Device
代码语言:powershell复制cmd.exe /c devcon.exe disable "IDECdRomQEMU_QEMU_DVD-ROM*" 2>&1 > $null
cmd.exe /c devcon.exe disable "HDAUDIOFUNC_01*" 2>&1 > $null
搞成代码如下
代码语言:powershell复制Set-ExecutionPolicy Unrestricted -force
$client = new-object System.Net.WebClient
$client.DownloadFile('http://windows-1251783334.cos.ap-shanghai.myzijiebao.com/wget64.exe',' c:windowswget.exe')
wget.exe http://windows-1251783334.cos.ap-shanghai.myzijiebao.com/115.159.148.149/devcon.exe -O c:windowsdevcon.exe
mkdir -force C:Scripts
wget http://windows-1251783334.cos.ap-shanghai.myzijiebao.com/disableHDAudioCDROM.ps1 -Outfile C:ScriptsdisableHDAudioCDROM.ps1
schtasks /create /tn "MicrosoftWindowsdisableHDAudioCDROM" /ru SYSTEM /rl highest /sc ONSTART /tr "Powershell C:ScriptsdisableHDAudioCDROM.ps1" /f
这样设置后,每次重启机器都会禁用腾讯云光驱和High Definition Audio Device
只是禁用普通CVM自带的QEMU光驱,其他虚拟光驱比如高版本windows系统天然自带的微软虚拟光驱和其他第三方虚拟光驱不受影响