keebz icon

Manage Open Files - PS on Server 2008 R2

keebz | PRO | 03/31/15 12:26:37 PM UTC | 0 ⭐ | 354 👁️ | Never ⏰ | []
PowerShell |

590 B

|

None

|

0 👍

/

0 👎

& net session | ? { $_ -match '^(\S+)\s+(\w+)\s+(.*)\s+(\d+)\s+(\S+)\s*$' } | % {
  New-Object -Type PSObject -Property @{
    'Client' = $matches[1]
    'User'   = $matches[2]
    'Type'   = $matches[3].Trim()
    'Open'   = $matches[4]
    'Idle'   = $matches[5]
  }
}
 
& net file | ? { $_ -match '^(\d+)\s+(.*)\s+(\w+)\s+(\d+)\s*$' } | % {
  New-Object -Type PSObject -Property @{
    'ID'    = $matches[1]
    'File'  = $matches[2].Trim()
    'User'  = $matches[3]
    'Locks' = $matches[4]
  }
}
 
#http://stackoverflow.com/questions/29209972/monitor-shared-file-access-using-powershell

Comments