You can use the following script to store a snapshot of the open files in a grid. You have to adapt the path to handle.exe.
C:\Usr\sysint\handle.exe | foreach{
if ($_ -match '^(?<program>\S*)\s*pid: (?<pid>\d*)\s*(?<user>.*)$') {
$matches | %{
$id = $_.pid
$program = $_.program
$user = $_.user
}
}
if ($_ -match '^\s*(?<handle>[\da-z]*): File \((?<attr>...)\)\s*(?<file>(\\\\)|([a-z]:).*)') {
#$_
$matches | select @{n="Pid";e={$id}}, @{n="Program";e={$program}}, @{n="User";e={$user}}, @{n="Handle";e={$_.handle}}, @{n="attr";e={$_.attr}}, @{n="Path";e={$_.file}}
}
} | out-Gridview
I would like to fetch just the files in the current disk queue.
2010-01-16 Edited. I had a problem with html escape characters. Thanks for the comment.
Hallo,
AntwortenLöschenetwas ist falsch.
Error -> BadOperatorArgument for -match
-----
if ($_ -match "^(?\S*)\s*pid: (?\d*)\s*(?.*)$")
...
if ($_ -match '^\s*(?[\da-z]*): File \((?...)\)\s*(?:(\\\\)|([a-z]:).*)')
...
Danke für diese script.
You are right. The problem is caused by Copy_ColoredAsHtml, which didn't escape the '<' and '>'. Therfore the groupnames
AntwortenLöschenund and are not shown behind the question marks.
I'm trying to post a correcet version.
Sorry they are not show in the above Komment too.
AntwortenLöschenNext try the missing groups are:
AntwortenLöschen<program>
<pid>
<user>
<handle>
<attr>
<file>