How to run Power shell commands Remotely?

It’s tedious to log on to server(s) just to check something simple or even complicated.

You can create a remote session to the server instead of manually logging on to it and run the commands / programs like if you were physically logged on to it.

  1. Open Power shell as admin.
  2. Type in Enter-PSSession -Computername fqdn -credential $cred
  3. Or Enter-PSSession -Computername fqdn if your currently logged in creds have access to remote system.
  4. You will be prompted to enter the credentials for the server and after that you will be connected.
  5. You can now run the commands such as hostname and it will show you information of the computer you set up a remote session on.

It is really useful for tasks like manually updating AD Sync by running Start-AdSyncSyncCycle -Policytype Delta

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Create a website or blog at WordPress.com

Up ↑