2015/08/31

Montreal PowerShell User Group #01 - Introduction to PowerShell



-English-

This is our first Montreal PowerShell User Group ! We'll start easy with a presentation on the basics of PowerShell ! Hope to see you there! Pizza, PopCorn and some free games to win!

When 

Tuesday, 15th of September 2015

Where

Warner Brothers Games - 888 Maisonneuve Est - 6th Floor
Room: Jack Warner (In front of elevators)


2015/08/30

PowerShell - Remove special characters from a string using Regular Expression (Regex)

Some more string manipulations! Today I'd like to remove the special characters and only keep alphanumeric characters using Regular Expression (Regex).

You might be interested to check a previous article where I showed how to remove diacritics (accents) from some strings, see here: http://www.lazywinadmin.com/2015/05/powershell-remove-diacritics-accents.html


My goal is to be able to keep only any characters considered as letters and any numbers.
If you are familiar with Regex, you could do something simple as using the metacharacter \w or [a-z] type of things. It's great when you only work with english language but does not work when you have accents or diacritics with Latin languages for example.

Preview of the final solution

2015/08/29

PowerShell/Office 365 - Get an Exchange Online user's distribution groups efficiently

In my previous post I showed how to retrieve the membership of one or multiple groups. In today's post I want to find the Distribution groups a user belongs to.

There are multiple approaches you could be using to gather this information but as an example I'll re-use the same one-liner from my previous article and simply filter with Where-Object to find a particular User.

This is probably the route PowerShell beginners would take and it is working 'Fine' in a small environment but not very efficient, you'll see in the following example.

In this environment, there are a bit more than 1800 Distribution Groups. I want to know which Distribution Group I'm member of.

Retrieving the count of Distribution Groups and an User account in Office 365


2015/08/24

PowerShell/Office 365 - Get the distribution groups membership

I was recently looking at Office365/Exchange Online to retrieve Distribution Group membership. This is pretty simple using something like:
Get-DistributionGroupMember -Identity "Marketing"

Not that prior to perforce the following command you need to be already connected to Office365, see this post.

Retrieving all members of each Distribution Group

Now if I want to retrieve all the Distribution group members, it's bit trickier you'll see. First I started by listing the groups members. My PowerShell instinct made me type Get-DistributionGroup|Get-DistributionGroupMember but it did not work, see below:



As the error message is stating that this Cmdlet does not accept input :-/

By using Get-Help on Get-DistributionGroupMember, we can check the parameters accepting Input:

(Get-Help Get-DistributionGroupMember).parameters.parameter|Select-Object name,parametervalue,pipelineinput


2015/08/15

Windows 10 ADK - Issues while uninstalling Windows 8.1 ADK and installing Windows 10 ADK

Installing Windows 10 Assessment and Deployment Kit (ADK) on SCCM 2012 R2 SP1 was a bit tricky. To "upgrade" the Windows ADK from 8.1 to 10, Microsoft recommend to remove Windows 8.1 ADK prior to the installation of Windows 10 ADK. We had some issue uninstalling Windows 8.1 ADK and installing the Windows 10 ADK


Uninstalling the Windows 8.1

Issue

Uninstall did not complete successfully.
An error occured while uninstalling "Deployment Tools."

Could not acquire privileges; GLE=0x514
Returning Status 0x514

You can also look at the ADK install/uninstall logs here: C:\Users\<Account>\AppData\Local\Temp\adk


We found different solutions online such as:

  • Unjoin, install ADK and Rejoin the computer to the domain
  • Run the installer as a Local Administrator or domain admin
Unjoining the machine was out of questions and the second solution did not work (Same error message).

I also tried to
  • Remove one component at the time but always got stuck on the "Deployment Tools" component.
  • Repair W8.1 ADK and try again
Same result...