OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

Powershell -Mailbox switch isn't working correctly

  • Thread starter Thread starter Brad Watts
  • Start date Start date
B

Brad Watts

Guest
I've got a bit of an issue with Exchange Online Management Module where it won't recognise the -Mailbox tag.

It used to work, and on the Learn page it is still listed as being a correct parameter.

Below is the code and then the error I get.

Function EXO-UserMailboxRules { #Pulls back list of mailbox rules and formats with Name, Description and Enabled status #Get the username $GetUsername = Read-Host -Prompt "Enter username to check rules (you need to be connected to EXO first)" #Pull back list of rules based on Rule name, and select the name only $MailboxRuleList = get-InboxRule -Mailbox $GetUsername | select Name #Start Foreach loop. You can reference the Rule as a variable here, and then get it to pull one Name at a time as it goes foreach ($Rule in $MailboxRuleList) { $RuleName = $Rule.Name #Run Get-InboxRule again, this time on the rule name. Pull the Rule Name, Description, and if enabled get-inboxrule $RuleName -Mailbox $GetUsername | select Name, Description, Enabled | fl } }

Get-InboxRule : A parameter cannot be found that matches parameter name 'Mailbox'. At C:\Scripts\ExchangeManagement.psm1:38 char:38


  • Code:
    $MailboxRuleList = get-InboxRule -Mailbox $GetUsername | select N ...

  • Code:
                                     ~~~~~~~~
    • CategoryInfo : InvalidArgument: (:) [Get-InboxRule], ParameterBindingException
    • FullyQualifiedErrorId : NamedParameterNotFound,Get-InboxRule

I have tried finding another Paramater to use, but the MS Learn page shows using the -Mailbox to pick out the mailbox.

I can't think of what to try in the first instance as I am connected to EXO and it was working before.
<p>I've got a bit of an issue with Exchange Online Management Module where it won't recognise the -Mailbox tag.</p>
<p>It used to work, and on the Learn page it is still listed as being a correct parameter.</p>
<p>Below is the code and then the error I get.</p>
<p>Function EXO-UserMailboxRules {
#Pulls back list of mailbox rules and formats with Name, Description and Enabled status
#Get the username
$GetUsername = Read-Host -Prompt "Enter username to check rules (you need to be connected to EXO first)"
#Pull back list of rules based on Rule name, and select the name only
$MailboxRuleList = get-InboxRule -Mailbox $GetUsername | select Name
#Start Foreach loop. You can reference the Rule as a variable here, and then get it to pull one Name at a time as it goes
foreach ($Rule in $MailboxRuleList) {
$RuleName = $Rule.Name
#Run Get-InboxRule again, this time on the rule name. Pull the Rule Name, Description, and if enabled
get-inboxrule $RuleName -Mailbox $GetUsername | select Name, Description, Enabled | fl
}
}</p>
<p>Get-InboxRule : A parameter cannot be found that matches parameter name 'Mailbox'.
At C:\Scripts\ExchangeManagement.psm1:38 char:38</p>
<ul>
<li>
<pre><code>$MailboxRuleList = get-InboxRule -Mailbox $GetUsername | select N ...
</code></pre>
</li>
<li>
<pre><code> ~~~~~~~~
</code></pre>
<ul>
<li>CategoryInfo : InvalidArgument: (:) [Get-InboxRule], ParameterBindingException</li>
<li>FullyQualifiedErrorId : NamedParameterNotFound,Get-InboxRule</li>
</ul>
</li>
</ul>
<p>I have tried finding another Paramater to use, but the MS Learn page shows using the -Mailbox to pick out the mailbox.</p>
<p>I can't think of what to try in the first instance as I am connected to EXO and it was working before.</p>
Continue reading...
 
Top