Export list of users of an opened files.

Is there a way to export a list of users (first name, lastname and SAMID) who have a specific file opened on a Windows 2008 server?

I cannot do this from Open File Manager.

Please advise.  

Thanks.
nav2567Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

unknown_routineCommented:
1:Open Server Manager
2:Select Roles/Files Services/Share and Storage Management
3:In the Actions pane, select Manage Open Files

Then you can see who has the file open and also force close the file.
0
SubsunCommented:
You may try the Get-Openfiles function from following article..

http://andrewmorgan.ie/2012/12/05/viewing-open-files-on-a-file-server-from-powershell/

function get-openfiles{
param(
    $computername=@($env:computername),
    $verbose=$false)
    $collection = @()
foreach ($computer in $computername){
    $netfile = [ADSI]"WinNT://$computer/LanmanServer"
 
        $netfile.Invoke("Resources") | foreach {
            try{
                $collection += New-Object PsObject -Property @{
                  Id = $_.GetType().InvokeMember("Name", 'GetProperty', $null, $_, $null)
                  itemPath = $_.GetType().InvokeMember("Path", 'GetProperty', $null, $_, $null)
                  UserName = $_.GetType().InvokeMember("User", 'GetProperty', $null, $_, $null)
                  LockCount = $_.GetType().InvokeMember("LockCount", 'GetProperty', $null, $_, $null)
                  Server = $computer
                }
            }
            catch{
                if ($verbose){write-warning $error[0]}
            }
        }
    }
    Return $collection
}

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Powershell

From novice to tech pro — start learning today.