VMware Cloud Community
halr9000
Commander
Commander
Jump to solution

Why are all properties read-only?

$cdrom.ISOPath = $foo # won't work

$cdrom | set-cddrive -isopath $foo # works

Is there any reason you don't allow both methods? I don't know if that's the right thing to do, but I do see it a lot.

My signature used to be pretty, but then the forum software broked it. vExpert. Microsoft MVP (Windows PowerShell). Author, Podcaster, Speaker. I'm @halr9000
Reply
0 Kudos
1 Solution

Accepted Solutions
admin
Immortal
Immortal
Jump to solution

Making the properties writable introduces some questions around when changes are applied. If you set two properties, are they set one at a time? Do we add a method to apply the changes so you can set multiple? etc. In the end, we'd wind up having a set- cmdlet or the logical equivalent to account for those cases so we went with that path only. There's also the consideration that PowerShell provides additional platform support for cmdlets. I think in general we're going to err toward providing one path with the idea that we can always add more in the future while taking things out is difficult.

View solution in original post

Reply
0 Kudos
3 Replies
admin
Immortal
Immortal
Jump to solution

Making the properties writable introduces some questions around when changes are applied. If you set two properties, are they set one at a time? Do we add a method to apply the changes so you can set multiple? etc. In the end, we'd wind up having a set- cmdlet or the logical equivalent to account for those cases so we went with that path only. There's also the consideration that PowerShell provides additional platform support for cmdlets. I think in general we're going to err toward providing one path with the idea that we can always add more in the future while taking things out is difficult.

Reply
0 Kudos
halr9000
Commander
Commander
Jump to solution

Does the same thing go for methods? I was trying to figure out how to clone a VM after not seeing that support in any cmdlets. I then looked at the VM object, expecting to find a CloneVM method (as per the VI SDK docs), but no joy.

My signature used to be pretty, but then the forum software broked it. vExpert. Microsoft MVP (Windows PowerShell). Author, Podcaster, Speaker. I'm @halr9000
Reply
0 Kudos
admin
Immortal
Immortal
Jump to solution

You're correct - clone VM functionality is not in this build. Cloning a VM is just another way of creating a VM. I expect this will be part of New-VM down the road just as you can pass a Template to New-VM with this build.

The thing you could do with this build is to use Get-View to get the object which will allow you to call CloneTask.

Reply
0 Kudos