I am relatively new to using powercli and I am trying to write our DR script. This will include needing to edit the vmx file to use a replacement disk. I found the script on the following link, but it doesn't seem to work any more. I SWEAR it worked once. When I try now I don't get any errors from what I've got, and it just doesn't do what I want it to. Is there a log of any sort that I can look at to find out what is going on with this?
StartTime : 3/5/2012 1:38:50 PM
doesn't that get done when it does a "$vm = Get-View (Get-VM servername).Id" in the script that I posted link to ?
I'll try and do a Get-VM servername after I add to inventory, after I reconfigure the VLAN, and before I run the script I posted... for grins...
Here's what I'm testing with....
$a = Get-Folder "FolderName"
First part seems to work fine, it adds machine to inventory
Second part works fine, adds correct vlan
last part, not so much. I have used the $value from a vmx file that has been built manually thru removing and adding the disk via the gui. I can relace the vmx file, but think that being able to edit a vmx file like this will be benificial in the future...
So this will not change the keys of a vmx file ??
I was merely following the following link ....
Is this not correct ?
I've never edited the .vmx file using PowerCli but I did notice that in order for manual edits to work I had to have the VM powered off and sometimes I had to remove the vm from and readd it to the inventory.
If this method works, I'll be one happy camper.
No, not the GUI.
If the property can be changed through one of the API methods, it will most probably not work through the ExtraOptions method.
These API methods are in fact what is underneath the PowerCLI cmdlets.
The ExtraConfig property is exactly that, an extra to configure all the values in the VMX file that are not accessible through other properties in the VirtualMachineConfigInfo object.
The modifications which I was attempting to make are not available in the GUI while the VM's are running. I was trying to edit the advanced configurations. Regardless if you are using the GUI or hacking the .vmx file, in my experience the VM had to be powered off.
That is correct, for most of the VMX entries the VM needs to be powered off.
And sometimes even unregistered from the vCenter.
If you power off a VM it will save the in-memory settings to the VMX file, and the changes you made will most probably be overwritten.