using the get-counter cmdlet to gather data from machines seems somewhat cumbersome.
I tryied to use the invoke-command cmdlet in combination with get-counter to have the remote machines do the job.
The question is now: How can I aggragate the data the remote machines produce.
When using get-counter without invoke-command I can add an export-counter cmdlet which writes all data in one nice .blg file. With invoke-command I did not get this to work.
Unable to create the \MYCOMPUTER\temp\myoutput.blg file. Verify that the path is valid.
+ CategoryInfo : InvalidResult: ( [Export-Counter], Exception
+ FullyQualifiedErrorId : FileCreateFailed,Microsoft.PowerShell.Commands.ExportCounterCommand
+ PSComputerName : REMOTECOMPUTER
I checked for permissions. I can access the share \MYCOMPUTER\temp from another server box when logged in to Windows without having to authenticate explicit.
share permission is set to “Everyone” R/W
Security is set to “Everyone” Full control
I tested with test-path and resolve-path as well from a remote box:
resolve-path : Cannot find path ‘\MYCOMPUTER\temp’ because it does not exist.
+ CategoryInfo : ObjectNotFound: (\MYCOMPUTER\temp:String) [Resolve-Path], ItemNotFoundException
+ FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.ResolvePathCommand
Test-path and resolve-path from a Windows Server 2008 R2 box to my Windows 7 share works.
Test-path and resolve-path from a Windows 7 box to my own Windows 7 share does not work.
The problem is most likely authentication. By default, the computer you’ve remoted to cannot use your credential to access non-local resources like a UNC. This is referred to as the “second hop” problem, and is discussed in “Secrets of PowerShell Remoting,” one of our free ebooks (Resources menu here on the site).