New-ComplianceSearch not visible in Exchange Online despite being in “Discovery Management”

So just today I learned new thing, I was missing New-ComplianceSearch cmdlet, I was a bit frustrated because I was in all the relevant groups:

Technet was not mentioning a WORD about one thing, I was able to use compliance cmdlets only after I connected diffrently, so if this is your connection string:

$Session = New-PSSession -ConfigurationName Microsoft.Exchange –ConnectionUri -Credential $Credential -Authentication Basic –AllowRedirection

Change it to:

$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri -Credential $Credential -Authentication Basic –AllowRedirection

This should do the trick.



Exchange Online and Microsoft.Exchange.Data.SharingPolicyAction is invalid error on Get-MailboxFolderPermission


Recently we got an issue on Exchagne Online, for one mailbox (yes 1! :)) we were not able to properly read permissions, the error was:

•	WARNING: An unexpected error has occurred and a Watson dump is being generated: Value specified for a parameter of type <span id="mce_SELREST_start" style="overflow:hidden;line-height:0;"></span>Microsoft.Exchange.Data.SharingPolicyAction is invalid<span id="mce_SELREST_end" style="overflow:hidden;line-height:0;"></span>: 0.
•	Parameter name: allowedActions
•	Value specified for a parameter of type Microsoft.Exchange.Data.SharingPolicyAction is invalid: 0.
•	Parameter name: allowedActions
•	    + CategoryInfo          : NotSpecified: (:) [Get-MailboxFolderPermission], EnumOutOfRangeException
•	    + FullyQualifiedErrorId : Microsoft.Exchange.ExchangeSystem.EnumOutOfRangeException,Microsoft.Exchange.Management.StoreTasks.GetMailboxFolderPermission
•	    + PSComputerName        :


After contacting Microsoft they suggested running following command:

Get-SharingPolicy | Set-SharingPolicy -Domains Anonymous:CalendarSharingFreeBusySimple,*:CalendarSharingFreeBusyDetail

After running the above command we were able to properly rad permissions. More details about sharing policies can be found here.


PowerShell -Filter vs. Where-Object – what is the main difference?

Well – timing. For instance if we would like to ask AD for certain user accounts,  -Filter will process the data on the remote computer (domain controller) and will send us only the filtered results, whilst Where-Object (?) will sends us all the results, and “filtering” takes places on our end. Here is a small example of the speed differences:

measure-command {Get-remotemailbox -Filter {RecipientTypeDetails -eq "RemoteRoomMailbox" -and name -like "*people*"}}

Days              : 0
Hours             : 0
Minutes           : 0
Seconds           : 0
Milliseconds      : 756
Ticks             : 7564893
TotalDays         : 8,75566319444444E-06
TotalHours        : 0,000210135916666667
TotalMinutes      : 0,012608155
TotalSeconds      : 0,7564893
TotalMilliseconds : 756,4893

measure-command {Get-remotemailbox | ? {$_.RecipientTypeDetails -eq "RemoteRoomMailbox" -and $ -like "*people*"}}

Days              : 0
Hours             : 0
Minutes           : 0
Seconds           : 18
Milliseconds      : 415
Ticks             : 184153984
TotalDays         : 0,000213141185185185
TotalHours        : 0,00511538844444444
TotalMinutes      : 0,306923306666667
TotalSeconds      : 18,4153984
TotalMilliseconds : 18415,3984

Filter was 24 times faster!

What if Optimize-StoragePool doesn’t work with the “-WhatIf” switch?

Just recently I was running optimization job on S2D pool, so lead by curiosity I wanted to start it with the “-whatif” witch, like this:

$UniqueId = (Get-StoragePool | Where {$_.IsPrimordial -eq $false}).UniqueId
Optimize-StoragePool -UniqueId $UniqueId -whatif

I have found it on this wonderful blog:

And guess what? It started to do the job…

So be aware about that once “testing” the Optimize-StoragePool cmdlet.

Messages send to a distribution group visible in Exchange Online’s Get-MessageTrace as failed – not really failed.

So I noticed today that some messages are getting failed status, I was particulary interested in one message that for sure was a legit one – same as the distribution group it supposed to be delivered to.


Well..ok, so what happened to it then, I used Get-MessageTraceDetails to check it.

Continue reading “Messages send to a distribution group visible in Exchange Online’s Get-MessageTrace as failed – not really failed.”

Sneaky tricky management scopes in Exchange Online.

If you’ve been creating scopes in Exchange Online in, for instance, following way…:

$Group = Get-DistributionGroup -Identity “RoomImpersonationGroup”
New-ManagementScope “Room Mailboxes Impersonation” -RecipientRestrictionFilter “MemberOfGroup -eq ‘$($Group.DistinguishedName)'”

…so using a DistinguishedName attribute – you might experience a moment when this solution stops to work.


Continue reading “Sneaky tricky management scopes in Exchange Online.”

Automated way to check Mellanox RDMA ping (nb_send_bw.exe) across nodes in a Hyper-V cluster.

So just recently we got need of checking RDMA ping between nodes, and as we got a few the task of running nb_send_bw.exe was getting a little fiddly. As we were waiting for repair storage jobs to finish between restarts I wrote a few lines to automating task.


Continue reading “Automated way to check Mellanox RDMA ping (nb_send_bw.exe) across nodes in a Hyper-V cluster.”