2

I want to run handle for a specific folder for a remote pc at my network so to know which processes are locking the folders.

tried:

handle /accepteula \\remotePcName\c:\myFolder

handle /accepteula \\remotePcName\User(name of the account)\c:\myFolder

and some other combinations with no luck getting

No matching handles found.

Is it possible to do this? Run handle for a remote pc?

Joe DF
  • 5,438
  • 6
  • 41
  • 63
C Ts
  • 21
  • 4
  • is your c: shared out as `c:`? Is that what shows up when you browse to `\\remotePcName`? c: would not be a valid path name anyways due to the `:`. Perhaps you want `\\remotePcName\c$` – Marc B Mar 10 '14 at 16:20
  • Actually I have it shared as C. Tried \\remotePcName\c but still getting No matching handles found – C Ts Mar 10 '14 at 16:24
  • and from reading the handle docs, I doubt it can actually work on a UNC path anyways. The sort of information it needs isn't available remotely. – Marc B Mar 10 '14 at 16:26
  • So no way to make it work? How about with an IP? Do you have a link for the doc? – C Ts Mar 10 '14 at 16:35
  • http://technet.microsoft.com/en-ca/sysinternals/bb896655.aspx – Marc B Mar 10 '14 at 16:37
  • 1
    you could try psexec to execute a remote copy of handle that's already on that machine. but that's opening a whole diferent ball of wax. – Marc B Mar 10 '14 at 16:37
  • Thanks for the link. I already have installed handle to the other machines so I think if it's possible to do by executing the handle at the remote machine it's ok for me. – C Ts Mar 10 '14 at 16:43
  • Ok, by executing the handle with psexec I could take the results I want. Here what I've done: psexec /accepteula \\remotePcName handle \myFolder – C Ts Mar 11 '14 at 16:59

2 Answers2

0

Could you please try like this:

c:\powershell\Tools\psexec.exe \\remotePcName C:\handle.exe c:\myFolder
moskalevN
  • 348
  • 5
  • 11
0

How about using invoke-command to execute 'handles' remotely?

$serverName = 'serverName'
$pathtoCheck = 'C:\temp' # folder you want to check on the remote server.
$pathtoHandle = 'c:\temp\handle.exe' #location of handle.exe on the remote server.

Invoke-command -ComputerName $serverName -Scriptblock {
    param(
    [string]$handles,
    [string]$pathToCheck
    )
     "$handles /accepteula $pathToCheck" | Invoke-Expression 
    } -ArgumentList $pathtoHandle,$pathtoCheck
A.D
  • 76
  • 2