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

EnterpriseArchitect 4,826 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.

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,716 questions
Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,389 questions
0 comments No comments
{count} votes

Accepted answer
  1. Limitless Technology 39,391 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--

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful