Powershell – Remote Commands


To run the `ipconfig /displaydns` command on a remote PC named “pc-kcordero” in a Windows environment, you can use the `Invoke-Command` cmdlet from PowerShell. Here’s an example:

Invoke-Command -ComputerName lt-kcordero -ScriptBlock { ipconfig /displaydns }

This command connects to the remote PC “pc-kcordero” and executes the `ipconfig /displaydns` command within a script block. The output will be displayed on your local machine.

Note that you need to have administrative access or appropriate permissions on the remote PC to run the command remotely. Additionally, ensure that the remote PC allows PowerShell remoting and that you have network connectivity to the target machine.

If you encounter any issues or errors, please provide more details about the problem, such as error messages or specific symptoms, so that I can assist you further.


If you have administrative access or remote management capabilities to the remote machine, you can use PowerShell along with other commands or tools to retrieve the DNS cache information indirectly. Here’s an alternative approach using PowerShell and the `Get-DnsClientCache` cmdlet:

1. Establish a remote PowerShell session with the target machine:

   Enter-PSSession -ComputerName lt-kcordero -Credential {Username}

Replace `{Username}` with the appropriate credentials to authenticate on the remote machine.

2. Once the remote session is established, you can run the following command to retrieve the DNS cache information:


This command will display the DNS cache entries on the remote machine.

Please note that this approach requires administrative access or appropriate permissions on the remote machine. Additionally, you need to ensure that PowerShell remoting is enabled on the target machine and that you have network connectivity to establish the remote session.

If you encounter any errors or issues, please provide any error messages or specific symptoms you observe, and I’ll be glad to assist you further.


You might get an error message like “WinRM cannot complete the operation” which typically occurs when there are issues with the WinRM (Windows Remote Management) service or configuration on either the local or remote machine. Here are some steps you can try to resolve this issue:

1. Ensure WinRM Service is Running: On the remote PC (pc-kcordero), check if the WinRM service is running. You can do this by opening a Command Prompt or PowerShell with administrative privileges and running the following command:

   sc query winrm

If the service is not running, start it by running:

   sc start winrm

2. Enable WinRM Remotely: On the remote PC (pc-kcordero), you need to enable WinRM for remote management. Open a Command Prompt or PowerShell with administrative privileges and run the following command:

   winrm quickconfig

This command configures the WinRM service to listen for remote management requests.

3. Check Firewall Settings: Ensure that the firewall on the remote PC (pc-kcordero) allows WinRM connections. By default, the necessary firewall rules are created during the “winrm quickconfig” step mentioned above. However, if there are custom firewall rules or group policies in place, they may be blocking WinRM connections.

4. Verify Network Connectivity: Ensure that you have network connectivity to the remote PC (pc-kcordero). Make sure you can ping the remote PC and that there are no network-related issues preventing communication.

5. Enable PowerShell Remoting: On the local machine (the machine from where you are running the command), you need to enable PowerShell remoting if it’s not already enabled. Open a PowerShell session with administrative privileges and run the following command:


This command enables PowerShell remoting on the local machine, allowing it to establish a remote connection to other computers.

After performing these steps, try running the `Invoke-Command` command again. If you continue to encounter the same error, please provide any additional error messages or details that might help identify the cause of the problem.