I've a powershell script which runs on server(test-server) and reads the log file of his client(DC1).
- Both sides can ping to each other.
- On both sides, firewalls are disabled.
Remote Desktop and Remote Assistance are enabled on DC1.
Get-EventLog System -ComputerName test-server -Source Microsoft-Windows-Winlogon # WORKS Get-EventLog System -ComputerName DC1 -Source Microsoft-Windows-Winlogon # DOESN'T WORK
I run this script on test-server. As you see when I read the local log file on test-server it works fine but if I try to read the log file of DC1 remotely I get the error "Get-EventLog : The network path was not found.".
Screenshot of the error:
How can I avoid this error and read the log file of DC1 from test-server with using Get-EventLog?
@Lars Truijens's suggestion solved my issue. But other suggestions are also important to check.
So, here is the checklist if you get this kind of error when you try to get log files remotely:
dir \\dc1\c$
to see that you are allowed to reach to the harddisk. (@Shay Levy's suggestion)Get-Service -ComputerName YOURCOMPUTERNAME
to see that you are allowed to reach to the services. (@Shay Levy's suggestion)Here is the screenshot of this solution:
Starting the RemoteRegistry service did not help in my case.
Apparently, there is a difference between the remoting that is accessed via the ComputerName parameter in some cmdlets such as Get-Service and the newer form of remoting accessed with cmdlets such as Invoke-Command.
When I swapped from this command
to this
I no longer got the following error