Client-Side Interaction

Product: PowerShell Universal
Version: 2.8.3

I’m in need of creating a couple buttons that will interact with the client’s operating system. In the past I’ve seen some issues where a file will open on the server hosting PowerShell Universal instead of opening on the client’s computer.

  1. Click a button and a word document opens on the clients machine
  2. Click a button and a RDP session initiates a connection to a targeted machine by running. Ultimately I’d like to run “mstsc v:/Server1” on the client’s computer. How can you run such command on the client’s computer?

Opening a word document on a client’s machine would imply that the document is downloaded from the PSU server to the clients machine and then opened like any other downloaded document.

Initiating a RDP session isn’t possible by simply ‘running a command on the client’s computer’. This would introduce major security vulnerabilities and is thus blocked by any modern web browser.

What you could do is implement a custom protocol handler that you would have to configure on the clients computer to understand said protocol when invoked from a browser.
Worth looking into:
RdpProtocolHandler

On the client’s computer, I can run the following command and it downloads the file successfully.
Invoke-WebRequest "file://serverName/C$/Files/Server1.rdp" -OutFile "C:\Server1.rdP

I was hoping there was a way to add this to the dashboard code so that when they click the button, they download the document. If there is a way to implement this, it would be sufficient for my needs, as I’m fine with just the user downloading it on click (opening it for them is not necessary).

Have a look at the documentation; interaction/downloads
combined with; published-folders and download-files

Should get you all the way there!

Start-UDDownload is still limited to text files only, but the Published folders piece is required. I was able to piece together a solution with the help of another post here: Download file from published folder - #8 by mtndrew11

Now when a user clicks a button, a word document (or any other file) is downloaded to their local machine. Still chewing on some options on how to launch an RDP session when a user clicks on object on the dashboard.

Gotcha.

I’ve mentioned a possible solution for you before in regards to the RDP session invocation from a dashboard;

What you could do is implement a custom protocol handler that you would have to configure on the clients computer to understand said protocol when invoked from a browser.
Worth looking into:
RdpProtocolHandler