Hosting in Azure (or other external web hosting) - how to run scripts on client computer

Hi, this is a bit of a newbie question so please bear with me.

I know how to use PSU in my internal network to run scripts and get information across my servers as I obviously know the names of my servers so can use commands with -ComputerName for example to get the information.

But how do I use it when hosting in Azure (or in my case as per discussion here with a ASP.NET hosting provider) to run commands / scripts on the connecting client computer? as it could be any computer opening my webpage and logging into my dashboard with provided credentials and I won’t know the name of that computer to use with -ComputerName (or perhaps Invoke-Command)?

And related to this what issues will I face and how do I overcome them in relation to permissions / security when a user accesses my dashboard via website externally like this (compared to doing it via an internal network for example?)

Many thanks, and apologies for the “newb” question - but eager to learn here.

Product: PowerShell Universal
Version: 3.6.2

Anyone?

The sort of information I want to retrieve from the computer(s) will be system information such as disk size / space, RAM, processor information, information I would usually get via WMI etc

Hey @wingers,

This isn’t something that is easily accomplished. Running arbitrary scripts on a machine from a web browser is a huge security risk so you’d have to have some sort of system setup on the client machines to accommodate this.

If you can setup something like an Azure Gateway to connect from the Azure VM running PowerShell Universal down to your local networking, then you might be able to use PowerShell remoting like you are suggesting. Retrieving the actual computer name (or local IP address) from the web browser comes with set of issues but it may be possible.

Hi Adam, thanks for the response.

That puts a major dent in one of my planned use cases then.

I am hosting it via a third party ASP hosting provider (as per my detailed research here rather than in Azure, as cheaper and it runs really well for my needs)

I will control who runs the scripts (they will only be clients of my company), so it won’t be open to everyone so I can contain / control the risks if it can be done somehow?

If not back to the drawing board and will need to find another solution to achieve my ideas.