4

I have been trying to run Microsoft's GetNetworkStatistics script against remote computers to enable us to track what processes are using bandwidth along with other tools.

I am unable to run the script against remote Windows 7 clients. It works fine when run against a Windows Server 2012 r2 machine both remotely and locally. It also works fine when run on locally on Windows 7 machine.

I have run Enable-PSRemoting on the Windows 7 client and have allowed Windows Remote Management and Windows Management Instrumentation in Windows Firewall.

This is error I get when running against a remote Windows 7 machine

WARNING: Could not run Get-Process -computername win7.  Verify permissions and connectivity.  Defaulting to no
ShowProcessNames
'C:\netstat.txt' on win7 converted to '\\win7\C$\netstat.txt'.  This path is not accessible from your system.
At C:\Users\user\Desktop\Get-NetworkStatistics.ps1:200 char:25
+                         Throw "'$tempFile' on $computername converted to '$remot ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: ('C:\netstat.txt...om your system.:String) [], RuntimeException
    + FullyQualifiedErrorId : 'C:\netstat.txt' on win7 converted to '\\win7\C$\netstat.txt'.  This path is not accessi
   ble from your system.

I have tried running just get-process against the remote Windows 7 client which works locally but not remotely (It does work remotely and locally against Windows Server 2012 r2).

I have also run Invoke-Command {get-process} -computername $machinename -credential $domain\admin. And after providing the correct credentials it still yeilds the same results.

Any help would be greatly appreciated.

Andrew Schulman
  • 8,811
  • 21
  • 32
  • 47
  • 2
    Port 445 open? Can't access `\\win7\c$` without SMB. – Ryan Ries May 22 '15 at 03:34
  • Are you running the PowerShell prompt under domain admin credentials? Also, what Ryan said regarding SMB - Are you able to access "\\win7\c$" from a run box using the credentials you are running the script with? – bentek Jun 26 '15 at 16:00
  • Thank you for your replys. The issue was actually incredibly simple. I didnt realise that get-process relies on the Remote Registry Service when running against remote machines. On Windows 8 and Windows Server 2012, this service is started automatically, unlike older systems where it requires a manual start. As such, the problem has been solved – Josh Graham Jul 01 '15 at 13:26
  • 7
    You should add your last comment as an answer and then mark it as answered. This is still showing as the top un-answered question. thanks. – Patrick Jul 16 '15 at 08:16
  • This should be marked answered. There's no flag for this. – Jeter-work Aug 31 '16 at 18:12

1 Answers1

0

Make sure WinRM is running on the remote system. Based on the errors given, it sounds like it isn't. Check your firewall settings as well.

Windows Remote Management

If the system is part of a domain, you can set your group policy to turn it on automatically for the machines you want to manage remotely with powershell.

Only Windows Servers have this turned on by default. Windows clients have it turned off by default.

Jessie
  • 182
  • 1
  • 13