Thursday, 9 May 2019

AzureAD 2.0 - installing on Windows Server 2012R2

In order to install AzureAD 2.0 you need to install WMF5.1 first:

Then, run in powershell:

 And then check and import it:

You can now check new commands available:

You can also check following Microsoft site:

Windows Server 2008, 2012, 2012R2: Install-Module is not recognized

When you want to user Install-Module on Windows Server 2018 or older you can see following error:

This could happened if you for example need to install AzureAD 2.0 powershell.
You then need to go to :
and get the package for your operating system

Follow on screen wizard and restart your server.
After that you should not have problem using install-module cmdlet:

Friday, 29 March 2019

Using split in powershell to get remove part of the filename

In order to change filenames in bulk using string you can use split switch to filter out first part of the file name.
For example, when I need to cut of "car" part of the file name, then I can use

get-childitem|%{$newname=$ -split ("car")|select -Last 1;Rename-Item $ -NewName $newname}