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)" }