Hello,
I have a script which customizes virtual machines from a .csv file (attached).
The logical flow is this:
Modify memory,
modify vcpus,
modify notes,
modify network name (VLAN),
network settings,
set static IP address,
set hard disk size,
and finally:
expand hard disk.
I am using the invoke-script command to extend the disk after it has been expanded through VMware. To do this I use the following syntax:
xcopy $installdir\extddisk.txt \\$target\c$temp\ /f
invoke-VMscript -VM $VM.name -ScriptText "diskpart /S c:\temp\extdisk.txt" -Hostuser $HostUser -HostPassword $HostPass -GuestUser -GuestUser -GuestPassword $GuestPass
The problem is that since the disk is being expanded as a last step. If the VM is being deploy onto a VLAN which is not accessible (for example a DMZ VLAN) then I won't be able to copy the extdisk.txt file which the diskpart command depends on. Is there another way that I can transfer this file onto the VM directly?
The file's contents are extremely simple, it says:
rescan
select volume 2
extend
Since the file is so simple may I could even just create it on the server before deleting it once the command has run successfully?