NoKvm的Windows虚拟机创建脚本(change.bat)无法对开通的机器重命名。
经过排查是因为脚本change.bat中对机器重命名的命令存在语法问题才导致无法完成通过wmic对机器重命名的操作,报错:“Invalid Verb Switch.(谓词开关无效)”。
附图:
Windows Server 2022 自制系统模板报错:
Windows Server 2008R2 官方系统模板同样会报错:
脚本中存在语法问题的命令:
Call wmic computersystem where "name='%computername%'" call rename ecs-xxxxx
正确标准的wmic机器重命名命令应该是:
wmic computersystem where name="%computername%" rename "ecs-xxxxx"
经过测试,执行正常。
希望开发者能够更正一下这个错误,非常感谢!