Windows Vista Forums
Vista Forums Home Join Vista Forums Donate Vista Tutorials Tags

Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > PowerShell

Unlock a file beeing used by another user

Closed Thread
 
Thread Tools Display Modes
Old 05-26-2007   #1 (permalink)
Guest


 

Unlock a file beeing used by another user

Hello everybody
do you know how to unlock a file for wich the system thinks it is beeing
used by another user, like excel or word files ? i mean close every
connection to this file by a powershell script ?

bye
Nico


Old 05-28-2007   #2 (permalink)
Don Juan (leidegre)
Guest


 

RE: Unlock a file beeing used by another user

This is not really possible as far as I know.

What you can do is that you can get all the file descriptors or "open file
pointers" to the file you wish to "release" and see what applications is
currently locking it. But from there I'm pretty sure you cant change the
"sharing policy". So basically if the FD is set to no sharing, you can only
figure out what application is using the file, and if so choose to close that
app to relase the file for what purpose you need it.
Old 05-28-2007   #3 (permalink)
Keith Hill [MVP]
Guest


 

Re: Unlock a file beeing used by another user

"Don Juan (leidegre)" <DonJuanleidegre@discussions.microsoft.com> wrote in
message news310035B-0071-4F12-AB44-B9E884700170@microsoft.com...
> This is not really possible as far as I know.
>
> What you can do is that you can get all the file descriptors or "open file
> pointers" to the file you wish to "release" and see what applications is
> currently locking it. But from there I'm pretty sure you cant change the
> "sharing policy". So basically if the FD is set to no sharing, you can
> only
> figure out what application is using the file, and if so choose to close
> that
> app to relase the file for what purpose you need it.


And to figure out which application is using the file, you can use these
Sysinternals tools: procexp.exe or handle.exe. You can get these free at:

http://www.microsoft.com/technet/sys...s/default.mspx

--
Keith

Old 05-30-2007   #4 (permalink)
Marcel J. Ortiz [MSFT]
Guest


 

Re: Unlock a file beeing used by another user

I proposed a Community Extensions cmdlet for doing this based on the new
Vista restart manager APIs but I'm the only one that voted for it.

http://www.codeplex.com/PowerShellCX...orkItemId=9089


"Keith Hill [MVP]" <r_keith_hill@mailhot.nospamIdotcom> wrote in message
news815F850-9BC0-4443-8695-D131944D0699@microsoft.com...
> "Don Juan (leidegre)" <DonJuanleidegre@discussions.microsoft.com> wrote in
> message news310035B-0071-4F12-AB44-B9E884700170@microsoft.com...
>> This is not really possible as far as I know.
>>
>> What you can do is that you can get all the file descriptors or "open
>> file
>> pointers" to the file you wish to "release" and see what applications is
>> currently locking it. But from there I'm pretty sure you cant change the
>> "sharing policy". So basically if the FD is set to no sharing, you can
>> only
>> figure out what application is using the file, and if so choose to close
>> that
>> app to relase the file for what purpose you need it.

>
> And to figure out which application is using the file, you can use these
> Sysinternals tools: procexp.exe or handle.exe. You can get these free at:
>
> http://www.microsoft.com/technet/sys...s/default.mspx
>
> --
> Keith


Old 05-30-2007   #5 (permalink)
Keith Hill [MVP]
Guest


 

Re: Unlock a file beeing used by another user

"Marcel J. Ortiz [MSFT]" <mosoto@online.microsoft.com> wrote in message
news:uZ%23qaevoHHA.4960@TK2MSFTNGP02.phx.gbl...
>I proposed a Community Extensions cmdlet for doing this based on the new
>Vista restart manager APIs but I'm the only one that voted for it.
>
> http://www.codeplex.com/PowerShellCX...orkItemId=9089
>


Yeah I've been thinking that this would be nice but then I thought -
Sysinternals and PowerShell are now under the same roof so-to-speak. So I
posted a request on the microsoft.public.winternals newsgroup that the
PSTools suite (and I should add handle.exe) should be made available in a
PowerShell version. I've gotten no response to this post "PowerShelled
PSTools - When?" and was starting to get a bit discouraged but then I read
that Jeffrey was helping Mark Russinovich out with some PowerShell issues.
That's made me a bit more optimistic on this support coming from
Sysinternals team at Microsoft.

--
Keith

Closed Thread

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I unlock a listening port? Bill Cohen Vista General 0 05-16-2008 09:03 PM
how do i unlock keys wendy Vista hardware & devices 10 04-11-2008 07:38 PM
Unlock my desktop once and for all! Shannon Vista General 4 03-02-2008 03:04 PM
unlock my pc janetgran51 Vista security 5 12-19-2007 12:10 AM
I locked my vista...how do I unlock it? kcp Vista General 2 11-30-2007 10:25 AM








Vistax64.com is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media 2005-2008

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50