因此,我使用下面的脚本创建一个VM。我实际上有一个小的批处理文件,它打开putty,登录到CVM,提示我输入$name,然后运行下面的脚本。这个图像是我制作的,然后通过sysprep将其作为磁盘映像上传。
一切都很好,只是当我打开控制台时,它会经过Windows设置。我有一个Unnattend文件,但我不确定如何使用它与我的脚本。如果我通过GUI来创建VM,我只需将其指向文件共享中的未被关注的文件。
有办法附加sysprep文件吗?我想可能是参数vm。但我没有足够的聪明来弄清楚这部分,并认为也许有人更聪明可以帮助。第一个世界的问题,我知道,但它可以帮助我节省30秒,而不必键入管理员密码和设置键盘设置等。
#创建一个虚拟机
acli vm。create $name memory=$mem num_core_per_vcpu =$core num_vcpus=$vcpu uefi_boot=TRUE &&
#创建C:
acli vm。$name clone_from_image=$image &&
#
#创建一个D驱动器
acli vm。Disk_create $name bus=scsi create_size=$hd index=1 container=$container;
#创建光盘驱动器
acli vm。Disk_create $name bus=sata cdrom=true empty=true;
#添加一个网卡
for i in $(eval echo "{1..$END}");做acli vm。$name connected=true network=$vlan request_ip=true;完成;
#将虚拟机加入保护域
Ncli protect -domain protect name=$domain vm-name =$name &&
#权力在vm
acli vm。美元的名字
谢谢提前
最佳答案galad2003
I used the following command:<\/p>
acli vm.disk_update $name disk_addr=\"sata.0\" clone_from_image=\"AutoUnattend.iso\"<\/code><\/pre>I created an ISO with my Answer file in the root and uploaded the image to Prism. Make sure it is called \u201cunattend\u201d. I could have sworn Windows required it to be named AutoUnattend.xml but that didn\u2019t work until I changed the name.<\/p>
So this will work like the GUI where you can upload an Answer file when creating a VM but without using a GUI because yuck.<\/p>
I could also put the answer file in my image and have it run that way but 1. If I update my answer file I have to update my image. 2. I can use different answer files with the image.<\/p>
My next step may be to get this loop for more than 1 VM and\/or create them from a CSV (not sure if that will be possible).<\/p>","className":"post__content__best_answer"}">