I'm trying to do the same thing as in this post.. http://communities.vmware.com/message/1298627;jsessionid=5EBBA0D2B3D0842F93165519F6BF20F7
I am using virtualdeviceconfigspec but I am encountering an error trying to set the Device.Backing.DeviceName property. It is telling me that it doesn't exist on that object. I think this may have something to do with the fact that I am trying to set a distributed switch port group but not certain.
You are right, for a dvSwitch portgroup it has to be done a bit differently.
Have a look at my dvSwitch scripting – Part 2 – dvPortgroup post.
It doesn't show how to do this during a clone operation but it shows how you can connect a dvSwitch portgroup to a guest.
If you want I could add a new post to my dvSwitch series on how to do this during clone operations ?