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 $_.name -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!

Advertisements

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:
http://www.darrylvanderpeijl.com/storage-spaces-direct-needs-rebalance/

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.

FailedMessage

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.”

VMware and windows file copy issues (copying hung, restarted, file used by another process error)

Recently some guys reported to me that copying between new server ad old ones behaves stangely – that at some point it stops at 0 bytes, for a long time and then renews.

I did some tests on my own and what found out is that not only files got stuck at some points at 0 bytes, but also seems that copy operation is being renewed (!) somehow.

I didn’t believe my own eyes – so I copied the file on  more time, but this time I was watching closely the status bar – at around 32% it started once again from 0% o_O

Continue reading “VMware and windows file copy issues (copying hung, restarted, file used by another process error)”

Exhange Online and “Cannot process argument transformation on parameter…” RBAC error.

So today I was trying to create some RBAC roles for our IT support. All I wanted to do is to create a new RBAC role and then add some cmdlets that were missing there – it was about message tracking.

Apart from that thing I find seriously messed up is a fact that role group “Message Tracking” does not contain “Get-MessageTrace” cmdlet.

WTFMS

Whole story happens in Exchange Online so I tried to create am empty roleand add two needed cmdlets to it – I was not able to do it, as Exchange Online prevents from creating such empty roles – you need to specify a parent.

However, if a parent role does not contain a cmdlet you are interested in you are not able to add it.

Well, sweet… so I created a role based on a parent which contained a lot of others cmdlet and tried to remove entries using “where”, like this:

Get-ManagementRoleEntry “SupportTeam” | ? {$_.name -notmatch “get-messaget”}| Remove-ManagementRoleEntry

Simply – I wanted to leave only cmdlets responsible for message trace.

Here is the place I got error from the subject:

errorrbac.jpg

So I started to read about it, and apparently Remove-ManagementRoleEntry is not accepting pipeline in o365…

https://blogs.technet.microsoft.com/rmilne/2015/02/05/remove-multiple-management-role-entries-in-office-365/

So you either need to prepare lines for each role entry in excel (for isntance using “concatenate”), or create a script, or use ready solution presented in the above blog.

 

X500 addresses – where is the beef?

x500aliens

Here is a great site that explains why x500 is needed and when it is used in on-prem and hybrid scenarios:

https://eightwone.com/2013/08/12/legacyexchangedn-attribute-myth/

Also, here is a little bit related subject about how to marry together a local AD account and already created o365 mailbox:

http://techgenix.com/match-office-365-mailbox-new-premises-user-hybrid-deployment/

Good article about history of x500:

https://www.experts-exchange.com/articles/9650/NDRs-and-the-legacyExchangeDN.html

And some good article about x400 history:

http://techgenix.com/x400-addresses-exchange-2010-part1/