我一直在嘗試運行微軟的取得網路統計腳本針對遠端計算機,使我們能夠與其他工具一起追蹤哪些進程正在使用頻寬。
我無法針對遠端 Windows 7 用戶端執行該腳本。當在 Windows Server 2012 r2 電腦上遠端和本機運作時,它都能正常運作。在 Windows 7 電腦上本地運行時它也可以正常工作。
我已在 Windows 7 用戶端上執行 Enable-PSRemoting,並在 Windows 防火牆中允許使用 Windows 遠端管理和 Windows Management Instrumentation。
這是我在遠端 Windows 7 電腦上運行時遇到的錯誤
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.
我嘗試過僅針對遠端 Windows 7 用戶端執行 get-process,該用戶端在本機上工作但無法遠端執行(它確實可以在 Windows Server 2012 r2 上遠端和本機工作)。
我也跑過Invoke-Command {get-process} -computername $machinename -credential $domain\admin
。在提供正確的憑證後,它仍然會產生相同的結果。
任何幫助將不勝感激。
答案1
確保 WinRM 正在遠端系統上運作。根據給出的錯誤,聽起來好像不是。也要檢查您的防火牆設定。
如果系統是網域的一部分,您可以將群組原則設定為自動為要使用 powershell 遠端管理的電腦開啟它。
預設情況下,只有 Windows 伺服器啟用此功能。 Windows 用戶端預設將其關閉。