Users

All Posts (10)

avatar

Philip

PowerShell like command for external C# application

avatar
avatar
avatar

Thanks for your help. The problem is, a no PowerShell user will not take care to run that script before or after an update. If you could provide me with that script would be nice and for the time being I can life with that. Looking forward to see a proper module from you! And I hope you will extend the possibilities of the commands like piping or directly search for a session instead of getting all.

Even better would be the option to do it directly from C#, let's see what the future will bring.

I have created a new class to handle my request. Maybe somebody else can use it as well:

public class RDMSession

{

public string id { get; set; }

public string dataSourceId { get; set; }

public string name { get; set; }

public static List<RDMSession> ReceiveSessionList()

{

PowerShell ps = PowerShell.Create();

ps.AddScript("Add-PSSnapin -Name Remote.Desktop.Manager*; Get-RDMSession");

List<RDMSession> result = new List<RDMSession>();

foreach (PSObject item in ps.Invoke())

{

RDMSession session = new RDMSession();

session.id = item.Properties["id"].Value.ToString();

session.dataSourceId = item.Properties["dataSourceid"].Value.ToString();

session.name = item.Properties["name"].Value.ToString();

result.Add(session);

}

ps.Dispose();

return result;

}

public static RDMSession findFromSessionListByName(List<RDMSession> sessionList, string name)

{

return sessionList.Find(o => o.name == name);

}

}

Thank you!

Best regards,

Philip

PowerShell like command for external C# application

avatar
avatar
avatar

Hi Maurice,

thank you for your quick answer but it looks I was not clear enough.

My tool is only running on machines where RDM is installed. But I need to correct you, the powershell snap-in is not registered as a part of RDM. You need to manually register the assembly or start the powershell from within RDM. But are my co-workers not a PowerShell nerd like me so i can't rely that they will update the registration. Additional there is always the problem that if you don't unregistered the assembly before you update RDM then you need to clean the registry for the old Snap-In to get it working probably.

I have attached a image of the tool we are using in our office. At the moment I can search for a user and get all needed information to give remote support. I'm on the way to extend this tool to include clients and server as well. In case it's a server i would like to add a button so i can start a new session within RDM like a remote call.

So my request is to do the following within a C# code:

  • get the session id by query RDM with the hostname

  • request RDM to start a new session with the session id i just receive.

Is there an easy way to archive this?

Best regards,

Philip

PowerShell like command for external C# application

avatar
avatar
avatar

Hi,

I already use the PowerShell extension from you to open a session in RDM. Using Get-RDMSession and Open-RDMSession is really a fun and improve my work.

We also use a small tool to get quick information about user, clients and server, that also allow us to do some actions on those. I would really like to use the functionality of the PowerShell to connect to a server. I know there are command line arguments or even a web protocol handler but all of this require the session id of the server. I don't want to use a quick connect to a fqdn because then I loose the settings of the session, like authentication and so on.

I could try to create a PowerShell env within my code and add the snap-in but that would require that every of my co-worker has registered the snap-in. Another way is to read the information directly from the database.

I already have tried to add the RemoteDesktopManager.Core.dll as a reference but that also look too much. I hope you can help me with my Problem.

Thanks for your time!

Regards,

Philip

Confusion about VMWare Remote Console and issues with configuration

avatar
avatar
avatar
avatar

Hi!

Yes, here is a short example of the output:

Name vmID

---- ----

LER-EXCH-DB1 vm-10376

SNG-SRV-2008R2 18.03.2015 vm-1039

SNG-DC-1 vm-1049

LER-BES-2 vm-1123

I have recently created a PowerShell function to call the VMRC as I don't like the Open-VMConsoleWindow function. I got it managed to use the Session Manager to create a CloneTicket so that I can also enjoy the functionality of SSO.

Call this to get the session manager and acquire a CloneTicket:

$SessionManager = Get-View -Id SessionManager

$CloneTicket = $SessionManager.AcquireCloneTicket()

The output is something like: cst-VCT-52752068-1b72-e55a-088e-f4c984763223--tp-C0-2F-27-FD-54-22-89-D4-78-41-55-0B-75-BE-C7-E6-BF-B3-BB-BB

To get the Id I use: $ID = (Get-VM -Name $item | Get-View).MoRef.Value

And then I execute this:

. 'C:\Program Files (x86)\VMware\VMware Remote Console\vmrc.exe' "vmrc://clone:$($CloneTicket)@$($global:DefaultVIServer.Name)/?moid=$($ID)"

Maybe this help you as well.

Best Regards,

Philip

Confusion about VMWare Remote Console and issues with configuration

avatar
avatar
avatar
avatar

Hey,

sorry for my absence. I checked our System again and find something!

Result when connected to vcenter is this:

LER-XA-DC1 VirtualMachine-vm-16542

now I connected to the host and I got this from the same VM:

LER-XA-DC1 VirtualMachine-85

If you need me to test something else just let me know.

Best Regards,

Confusion about VMWare Remote Console and issues with configuration

avatar
avatar
avatar
avatar

Yes, if you remove the "VirtualMachine-" prefix you have the ID that the VMRC is requesting.

My machine from the command you gave me.

LER-XA-DC1 VirtualMachine-vm-16542

Confusion about VMWare Remote Console and issues with configuration

avatar
avatar
avatar
avatar

I tried to discover the id by PowerShell and there I also cannot find the exact ID. The id I have to use is vm-16542 but I only found VirtualMachine-vm-16542. Maybe that will help you already?

Confusion about VMWare Remote Console and issues with configuration

avatar
avatar
avatar
avatar

Also some Links I used:

http://www.virtuallyghetto.com/2014/10/standalone-vmrc-vm-remote-console-re-introduced-in-vsphere-5-5-update-2b.html

http://www.virtuallyghetto.com/2013/02/how-to-access-vsphere-remote-console.html

There is also this API but was not able to figure out if this is the new VMRC or the old one:

https://developercenter.vmware.com/web/sdk/55/vmrc

Confusion about VMWare Remote Console and issues with configuration

avatar
avatar
avatar
avatar

Hello,

sorry our Spam-Filter did not made a good Job the last days and I havent seen the notification. Thanks for looking into this so fast, very appreciated.

I think I can provide you with some important information after a small reasearch on my side.

You are right all seems to start with the web protocol handler, but you can also but this behind the executable and it will also run.

I think it's clear that the host, port and VM-id need to be provided by the customer. Okay we can provide the information that the entry is a VM with a VM name and then it could be possible to resolve the VM-id out of this but this is something for later maybe :D

If I provide nothing or only my username it will ask me for credentials and then it connects.

The other way is a ticket so we don't need to provide a username or password. But I need to explain the Web Client first.

You can connect to the Web Client to call https://<vcenter>:9443 and will provide a login mask. There is a checkbox to pass through the windows authentication (sso). Unfortunately VMware does not use the defaults and thex created their own authentication handler.

Seperatly there is something like a API on the vcenter available from https://<vcenter>/mob/ that requires as well a authentication I think via Basic Auth, again no SSO :(

After the authentication I can open https://<vcenter>/mob/?moid=SessionManager&method=acquireCloneTicket and on that page I need to press "Invoke Method" what will generate a Ticket: cst-VCT-52747def-a8a1-c30a-d5e2-76839fe37abc--tp-C0-2F-27-FD-54-22-89-D4-78-41-55-0B-75-BE-C7-E6-AF-93-AB-CB

This Ticket I can use to call the url again:

vmrc://clone:cst-VCT-52747def-a8a1-c30a-d5e2-76839fe37abc--tp-C0-2F-27-FD-54-22-89-D4-78-41-55-0B-75-BE-C7-E6-AF-93-AB-CB@<vcenter>:443/?moid=vm-16542

This will open the console without any further authentication needed and i think this is the best way we for the integration.

If you need any help please contact me, I will help you as much as I can.

Thanks!

Best regards,

Philip

Confusion about VMWare Remote Console and issues with configuration

avatar
avatar
avatar
avatar

Good day,

I searched the forum but there is a lot going on on both sites with each new version. The documentation is also not showing the latest information so I want to create a new topic.

Our VMWare environment is running at version 5.5 and we use the latest version of the RDM. My Machine run Windows 10 or Server 2012 R2.

So when I create a new VMWare Remote Console entry I go to the General tab and setup our vcenter connection. Now I have three configuration options, 'Default', 'VMware Player' or 'VMWare VMRC'.

VMWare Player is no option.

With Default it will open a PowerShell, this will connect to the Vcenter, this will invoke a URL what will open a Browser window and this will result in a very limited remote console.

The best would be the VMWare VMRC what I also use from within the vSphere Web Client. Here is the VMWare Download Link: https://my.vmware.com/de/web/vmware/details?downloadGroup=VMRC70&productId=353

But this VMRC does have another executable and another installation path: "C:\Program Files (x86)\VMware\VMware Remote Console\vmrc.exe"

The file RDM is searching for was find under: C:\Program Files (x86)\Common Files\VMware\VMware Remote Console Plug-in 5.5\Internet Explorer

But this one does not work "vMware Player is not installed properly on this system and cannot function. Please reinstall VMware Player".

Is it possible that the VMRC that RDM use is something old from VMWare? I really want to use the tool from the link above because it offers a lot of functions.

I hope you can help me somehow.

Best Regards,

Philip

1 - 10 of 10 items