Searching Public Folder Permissions

Given a samAccountName, we want to know on which public folder(s) in our Organization it has an AccessLevel configured, and what the level is.  This is possible using Powershell cmdlets like: 'Get-PublicFolder | Get-PublicFolderClientPermission -User <xxx>' however within our organization that approach takes approximately 15 minutes to wade through all our folders and return the complete list.

I'm assuming the only way we can do this is any faster is with a real(er) programming language like C# that provides APIs.  So to my questions: is C# the best choice?  If so, would someone be kind enough to point me towards how I might get started?  If there's a better language for this (please don't say VB), what do you recommend and why?

Thanks in advance!





  • Edited by E. Martin 12 hours 14 minutes ago
April 6th, 2015 3:08pm

The performance isn't probably going to increase just because you use C#, to get Public Folder client permissions you have two options you can use the EMS powershell cmdelts like you do (you can use them from c# using https://msdn.microsoft.com/en-us/library/office/ff326159%28v=exchg.150%29.aspx?f=255&MSPPError=-2147217396 but this won't make your code run any faster). The other method would be to use EWS https://msdn.microsoft.com/en-us/library/office/dd633710%28v=exchg.80%29.aspx however because EWS is a client API it won't assert and Admin rights meaning that the user running the Application will need rights to ever folder its run against to get the Client permissions which is not guaranteed (In the EMS cmdlet delegate admin rights are always asserted so you would only need view only admin to do this).

Performance is going to come down to how many folders do you have ? eg if you have 100000 folders its still going to require 100000 operations no matter what API you use to get the permissions. In the EMS (and EWS) you may be throttled if your request start to consume too many resources.

Using the approach 'Get-PublicFolder | Get-PublicFolderClientPermission -User <xxx>' isn't very efficient if your goal is to do this for multiple users. You would be much better just exporting all the rights for all the Folders into a searchable structure (like a database) then you can run multiple queries against this data source. Although it may still take 15 minutes to dump the permissions once dumped you can do full reporting against the source quickly for as many users as you like and if you need to do this on a repetitive basis just schedule the dump to run out of hours. What language you use to do it should come down to what your more comfortable with if your more comfortable with PowerShell then use that else use C#. The only real advantage to using C# would be to multi thread the permission dump and you can then process multiple folder simultaneously which would reduce the dump time however you would much more likely to get throttled.

Cheers
Glen

Free Windows Admin Tool Kit Click here and download it now
April 6th, 2015 11:52pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics