Discussion:
view process file handles
(too old to reply)
Justin Rich
2008-05-14 14:51:29 UTC
Permalink
im looking to get a list of file handles per process.

obviously started with the get-process and it has a handle property but that
doesnt seem to have what im looking for.

basically im looking for an example that will, lets say, tell me what file
WordPad has open.

Thanks
Justin
Justin Rich
2008-05-14 15:35:23 UTC
Permalink
after digging in to this a bit more im thinking this might be a little more
difficult than need be.

really my goal is to see if a backup job is done. the problem is i cant do
the standard file open loops because the file is 800+GB, i havent tried yet
but i assume its going to eat up a ton of resources. the box cant really
afford that...

the backup is from DB2 so there isnt a process i can watch or anything like
that.. i just need to see when there is no longer a handle to the file.
Post by Justin Rich
im looking to get a list of file handles per process.
obviously started with the get-process and it has a handle property but
that doesnt seem to have what im looking for.
basically im looking for an example that will, lets say, tell me what file
WordPad has open.
Thanks
Justin
Marco Shaw [MVP]
2008-05-14 16:33:41 UTC
Permalink
Post by Justin Rich
after digging in to this a bit more im thinking this might be a little more
difficult than need be.
really my goal is to see if a backup job is done. the problem is i cant do
the standard file open loops because the file is 800+GB, i havent tried yet
but i assume its going to eat up a ton of resources. the box cant really
afford that...
the backup is from DB2 so there isnt a process i can watch or anything like
that.. i just need to see when there is no longer a handle to the file.
Post by Justin Rich
im looking to get a list of file handles per process.
obviously started with the get-process and it has a handle property but
that doesnt seem to have what im looking for.
basically im looking for an example that will, lets say, tell me what file
WordPad has open.
Thanks
Justin
You can view advanced information on processes using WMI:
PSH>get-wmiobject -query "select * from win32_process where
name='notepad.exe'"

I don't think PowerShell or WMI will help you with determine whether a
particular file is in use. I'd think you'd have more luck using "handle":
http://technet.microsoft.com/en-us/sysinternals/bb896655.aspx

It's a DOS binary, so you should have any problems parsing the output
from PoSH.

Marco
--
Microsoft MVP - Windows PowerShell
http://www.microsoft.com/mvp

PowerGadgets MVP
http://www.powergadgets.com/mvp

Blog:
http://marcoshaw.blogspot.com
Justin Rich
2008-05-14 17:18:49 UTC
Permalink
that should cut it, thanks :)
Post by Marco Shaw [MVP]
Post by Justin Rich
after digging in to this a bit more im thinking this might be a little
more difficult than need be.
really my goal is to see if a backup job is done. the problem is i cant
do the standard file open loops because the file is 800+GB, i havent
tried yet but i assume its going to eat up a ton of resources. the box
cant really afford that...
the backup is from DB2 so there isnt a process i can watch or anything
like that.. i just need to see when there is no longer a handle to the
file.
Post by Justin Rich
im looking to get a list of file handles per process.
obviously started with the get-process and it has a handle property but
that doesnt seem to have what im looking for.
basically im looking for an example that will, lets say, tell me what
file WordPad has open.
Thanks
Justin
PSH>get-wmiobject -query "select * from win32_process where
name='notepad.exe'"
I don't think PowerShell or WMI will help you with determine whether a
http://technet.microsoft.com/en-us/sysinternals/bb896655.aspx
It's a DOS binary, so you should have any problems parsing the output from
PoSH.
Marco
--
Microsoft MVP - Windows PowerShell
http://www.microsoft.com/mvp
PowerGadgets MVP
http://www.powergadgets.com/mvp
http://marcoshaw.blogspot.com
Continue reading on narkive:
Loading...