Share via

Executing Powershell Graph script on remote server rather than locally on my computer ?

EnterpriseArchitect 6,386 Reputation points
2022-07-12T06:40:14.21+00:00

Hi Everyone,

I need some help and suggestion on how can I execute this code below from my team desktop while the actual PowerShell modules and the Script.PS1 is located on the \PAWSVR01-VM\Shared\Script1.PS1 ?

The goal here is to be able to execute the script while the user double-clicking on the script from their desktop will be presented with the login name to remotely executed the server PAWSVR01-VM (Privileged Access Workstation - https://learn.microsoft.com/en-us/security/compass/privileged-access-devices).

So all of the Powershell modules are just installed and maintained in the PAWSVR01-VM only rather than on each user's desktop locally.

Thank you in advance.

Windows for business | Windows Server | User experience | PowerShell
Microsoft Security | Microsoft Graph
0 comments No comments

Answer accepted by question author

Limitless Technology 40,106 Reputation points
2022-07-12T16:46:59.483+00:00

Hello EnterpriseArchitect,

Running a Powershell Script remotely is an easy thing, but there are different ways to achieve it. Some people prefer to run a remote Interactive Session to the remote machine, others prefer to run as Invoke-Command as it would allow to run simultaneously to many computers or be scripted to retrieve computer names from a CSV. As long as the remote machines have access to the shared location, there should not be a problem.

I will suggest to review the next reference document with guides and examples to see what fits you better:
https:// docs. microsoft. com/en-us/powershell/scripting/learn/remoting/running-remote-commands?view=powershell-7.2

---

Hope this helps with your query,
--If the reply is helpful, please Upvote and Accept as answer--

Was this answer helpful?

1 person found this answer helpful.
0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.