0 votes

So I modifyed the Script so that it can also search for the Public Folder Access as Owner. But i my getting an Error message.

{
$exchangeServer = "Server" # TODO: modify me
$parameterName = "Name" # TODO: modify me

try
{
# Connect to Exchange server
$session = New-PSSession -connectionURI "http://$exchangeServer/powershell" -ConfigurationName Microsoft.Exchange
Import-PSSession -session $session -CommandName "Get-Mailbox", "Get-MailboxPermission", "Get-PublicFolder" -AllowClobber

$mailboxes = Get-mailbox -ResultSize Unlimited
$publicFolders = Get-PublicFolder -ResultSize Unlimited
$guidsBytes = New-Object System.Collections.ArrayList
$parameterValue = $Context.GetParameterValue($parameterName)

# Check permissions for mailboxes
foreach ($mailbox in $mailboxes)
{
    $permissions = $mailbox | Get-MailboxPermission -User $parameterValue | Where{$_.AccessRights -like '*FullAccess*'}
    if ($NULL -eq $permissions)
    {
        continue
    }

    $guidsBytes.Add($mailbox.Guid.ToByteArray())
}

# Check permissions for public folders
foreach ($publicFolder in $publicFolders)
{
    $permissions = $publicFolder | Get-PublicFolderClientPermission -User $parameterValue | Where{$_.AccessRights -like '*Owner*'}
    if ($NULL -eq $permissions)
    {
        continue
    }

    $guidsBytes.Add($publicFolder.Identity.ToByteArray())
}
}
finally
{
# Close the remote session and release resources
if ($session) { Remove-PSSession -Session $session}
}

# Add mailboxes and public folders to report
$searcher = $Context.CreateGuidBasedSearcher($guidsBytes)
$Context.Items.Add($searcher)

image.png

by (340 points)
0

Hello,

It looks like the issue occurs because of the $parameterName variable being incorrect. You need to specify it with the param- prefix:

$parameterName = "param-Name" # TODO: modify me

Also, we are not quite sure what exactly you need to achieve. Please, describe the desired behavior in all the possible details with live examples.

0

Hello

So I what to get the mailbox full access permissions and public folder owner access, in one report.

So that when I search a user I get all the information about what full access the user has and what public folders the user as access to.

image.png

I changed the Param it but i'm still getting the same error.

image.png

0

Hello,

Thank you for specifying. However, there is no such thing as full access for public folders. For available permissions, have a look at parameter -AccessRights of the following Microsoft article: https://learn.microsoft.com/en-us/powershell/module/exchange/add-publicfolderclientpermission?view=exchange-ps#-accessrights. Please, specify the one you need and we will update the script for you accordingly.

Please log in or register to answer this question.

Related questions

0 votes
1 answer

We just busted our licence limit of 400, but we are only 320 employees. All the extras are either service accounts, external contractors accounts or old user accounts ... is reinstated on the 'managed accounts' list? Thank you for the guidance, Louis

asked Apr 11, 2022 by lw.fa (130 points)
0 votes
1 answer

So this works for us however we would like to add to check if the last group is at 3 users we would like to send a seperate email but would still like all the above to continue to happen the way it is.

asked Mar 2, 2022 by Keonip (160 points)
0 votes
1 answer

Are PowerShell commands supposed to show up in the programming interface after adding the module to the Adaxes server? I've installed modules and they don't show.

asked Aug 18, 2020 by ComputerHabit (790 points)
0 votes
1 answer

I am having this same issue, and I do think the Microsoft Support article will help, but I noticed in the Permissions that Exchange Trusted Subsystem is defaulted to Deny ... is, Should I remove the Deny Permission first before adding the Allow to Modify?

asked Dec 30, 2019 by svecchione3 (50 points)
0 votes
1 answer

Are we able to add any new filter items in the pull down window to add columns after running a search? If so how can we do this? If not when could this be added?

asked Jun 13, 2014 by babbeaw (320 points)
3,346 questions
3,047 answers
7,782 comments
544,982 users