clear-host
[string[]]$ComputerName = $env:COMPUTERNAME
$ServerObj = [adsi]"WinNT://$ComputerName/lanmanserver"
$colResources = $ServerObj.PSBase.Invoke("Resources")
foreach ($Resource in $colResources){
Try
{
$Path = $Resource.GetType().InvokeMember("Path","GetProperty",$null,$Resource,$null)
$User= $Resource.GetType().InvokeMember("User","GetProperty",$null,$Resource,$null)
$LockCount = $Resource.GetType().InvokeMember("LockCount","GetProperty",$null,$Resource,$null)
#Stockage des informations
$prop = @{User = $User
Path = $Path
LockCount = $LockCount
}
}
Catch
{
#catch exception
}
#write-host "$($prop.Path)`t$($prop.User)`t$($prop.LockCount)"
$prop
write-host ""
#write-host "$($Path)`t$($User)`t$($LockCount)"
}
Lien vers le fichier : cliquez ici
Pages Web
Site Web | Description |
---|---|
Soykablog | How Can I List Open Sessions and Open Files on a Computer ? |
Article(s) précédent(s)
Article(s) en relation(s)