How does one programiatically query virtual center to generate the remote console URL for guests?
You cannot generate the remote console URL for the VMs using the VI SDK. You would need to use the web access to do so.
Any guidance on doing it that way?
In .NET/C# that is Console.WriteLine(Encoding.ASCII.GetString(Convert.FromBase64String(b642text)));
So for the opposite you could just work backwords and generate a base64 string that covers you.
Looking at a couple examples I did to confirm this was the core of the wsUrl is "wsUrl=https://localhost/sdk?vmId=VirtualMachine|vm-9999&ui=36"
So you would just need to update the "vm-9999" w the moref id from VI SDK. The ui (I think) is the integer generated from the sum of the checkboxes you see in the ui. false/false = 0, true/false = 4 + 8, false/true = 1 + 32, true/true = 4 + 32 (36 is what I used)
So using the vm moref id and your "ui" selection you can genenratethe URL on demand. Build your string, encode to base64, append an underscore "_" to the end of the b64 string, take that whole chunk and append that to your VCs "https://<vc URL>/ui/vmDirect.do?view=" URL which will look like it was generated from the console UI.
Hope this helps and hope that it doesn't get swatted by the mods.
What I have encoded is "wsUrl=http://localhost:8085&vmId=VirtualMachine|1040&ui=36". From VI SDK, the moref of vm is vm-78, but what I get is 1040. Do you have any idea how to get 1040? Thanks for your help.
See my post below for what you want.
This document was generated from the following thread: Programatically Generate Remote Console URL