Skip to content

hochwald.net Posts

PowerShell: foreach vs. .ForEach and ForEach-Object with IF vs. .Where

I do a lot of workshops with developers and administrators (or DevOps if you like to call them that way).
During one of the last workshops, one of the admins asked me a clever question: “Why do you pipe so much? Why don’t you use .ForEach and .Where instead? This should be faster!“.

So we took an existing function (One I use to clean up all my event log entries, and decided to refactor it. To see the difference, we also created a wrapper script that can handle all the measurement for us.

Microsoft rolls back decision to take away internal usage rights from partners

When i saw the announcement of the changes to the Internal Use Rights (IUR) from Microsoft, I was shocked and pissed. Like many other partners, I told Microsoft, that this was a terrible idea, and that small partner must use the technology they need to support on a daily base. Now Microsoft has changed their mind, and they realised that the initial idea was bad! They announced that they would reverse the formerly announced changes.

We listened to you, and we have acted.

I also listened to you, and I also acted! You inspired me…

However, at least for me, the mind change comes too late!

Copy AD group memberships from a given Source User to a Target User

I while ago I publish some PowerShell tooling to copy the Active Directory group memberships between users. The tooling also able to sync the group memberships; if the Target User belongs to a group whom the Source User doesn’t, the tooling can remove these groups. That is perfect for cloning or during the movement of users between divisions.