I am banging my head on a issue that I need to figure out.
Basically I have written s PS script that creates a VMware virtual machine in our vcenter based on the variables it gets from a JSON file.
One of the functions I am trying to write into the script is for adding additional HDD’s to the VM.
So in the JSON I have a line for AddDisk:“#”.
Then for each additional disk that is requested there is an entry in the JSON of AdditionalHDSize#:“SizeOfDiskInGB” where the # incraments based on how many additional HDD’s are being requested.
I am trying to write a DO WHILE that will look at the AddDisk number and loop the script to add disks with the Disk size for each additional disk.
The part I am having a hard time with is dynamically updating the variable AdditionalHDSize#
Here is a sample of what I have currently that is not working.
When you post code, sample data, console output or error messages please format it as code using the preformatted text button ( </> ). Simply place your cursor on an empty line, click the button and paste your code.
Thanks. I always forget how to format the code in the post
The reason for the JSON is we are trying to automate this process with ServiceNow and getting SN to spit out a JSON to a folder that I can monitor looks fairly easy.
Here is the JSON that I am working with.