To manage SRV1 remotely using PowerShell, you’ll need to set up PowerShell Remoting. Here’s a step-by-step guide:
Step 1: Enable PowerShell Remoting on SRV1 On SRV1, run the following command to enable PowerShell Re moting:
Enable-PSRemoting -Force
This command configures the computer to receive PowerShell remote commands that are sent by using the WS-Management technology.
Step 2: Configure the TrustedHosts List (If Needed) If you’re managing SRV1 from a computer tha t is not part of the same domain, you’ll need to add the managing computer’s name to the TrustedHosts list on SRV1:
Set-Item wsman:\localhost\Client\TrustedHosts -Value " ManagingComputerName " -Concatenate -Force
Replace “ManagingComputerName” with the name of your managing computer.
Step 3: Start a Remote Session From your managing computer, start a remote session with SRV1 using the Enter-PSSession cmdlet:
Enter-PSSession -ComputerName SRV1 -Credential (Get-Credential)
This command prompts you for credenti als and then starts a remote session with SRV1.
Step 4: Run Remote Commands Once the remote session is established, you can run any PowerShell command as if you were directly on SRV1. For example:
Get-Service
This command gets the status of services on SRV1.
Step 5: Exit the Remote Session When you’re finished, exit the remote session:
Exit-PSSession
Note: Ensure that both the managing computer and SRV1 are properly configured to communicate over the network, and that any firewalls allow for the necessar y ports (default is 5985 for HTTP and 5986 for HTTPS) to be open for WS-Management traffic12.
By following these steps, you should be able to manage SRV1 remotely using PowerShell. Make sure you have the appropriate administrative privileges to perform the se actions.