none
Counting file types on remote computer

    Question

  • Hi!

     

    I am searching for solution to count the different files type on remote computer. While searching on Google i found a perfect script for local computer.

     

    Get-Childitem c:myfiles -Recurse | where { -not $_.PSIsContainer } | group
    Extension -NoElement | sort count -desc

    (Site Reference: http://techibee.com/powershell/count-files-by-extension-using-powershell/514 )

     

    In my case i want to perform the same thing on remote computer i tried with different options like

    Invoke-Command -ComputerName File01 -ScriptBlock {Get-Childitem  -Recurse | where { -not $_.PSIsContainer } | group Extension -NoElement | sort count -desc }

    I am getting error

     Connecting to remote server failed with the following error message : The WinRM client cannot complete the operation within the operation within the time specified. Check if the machine name is valid and is reachable over the network and firewall exception for Windows Remote Management service is enable

    I googled this error and found that i have to run enable-psremoting -force and it enable WinRM firewall exception enabled.

     

    I think i am doing some wrong in the code. I shall thankful for any help in this case.

     

    Cap..

     

     

     

    Monday, October 03, 2011 12:58 PM

Answers

All replies