PowerShell - Managing Remote sessions


Enabling PowerShell Remoting
On the computer we want to access remotely and execute PowerShell command remotely, we need to run following command:

Enable-PSRemoting -Force 

This command starts the WinRM service, sets it to start automatically with your system, and creates a firewall rule that allows incoming connections. The -Force part of the command tells PowerShell to perform these actions without prompting you for each step.



 
Executing PowerShell script 
Invoke-command –filepath “path” – computername “computername”
For E.g.
invoke-command -filepath C:\Bin\ADScripts\PKI\retrieveExpiringCertificates.ps1 -computername HQCAS02
Reference:

Comments

Popular posts from this blog

The install4j wizard could not find a Java Runtime Environment on your system. Please locate a suitable JRE...

Clients Unable to update - "Cached cookie has expired or new PID is available"

Java Control Panel Icon "Application Not Found"