/images/nasan-avatar.jpeg

Run a gpresult on a remote computer

How to run a gpresult on a remote computer

Use the Invoke-Command

You can simply use the Invoke Command to run the gpresult command on a remote computer:

  • Define the ComputerName after the Invoke-Command
  • In the ScriptBlock you can simply run your command

here comes the new highlight:

199
200
Invoke-Command -ComputerName 'ComputerName' -ScriptBlock{
    gpresult /r /USER 'username'

Run gpresult for a specific User in a RDS environment

In the following script you just have to define the username + the RDS ConnectionBroker. It will automatically find the Remote Desktop Server where the user is logged in an run the gpresult there: