powershell env:PSModulepath duplicate records Winserv 2016 TP4

I was testing some xAzure DSC configuration stuff on my Windows Server 2016 TP4 and noticed that when I was trying to use the resource it said that duplicate modules was found but I could not find any in the powershell module libraries and thus it ought to be something else,

I found the tweet that Ben Gelens sent pointing me to the $env:psmodulepath

Screen Shot 2016-03-23 at 22.02.29

So looking in my psmodulepath I could see that I had two records that was the same and that had to be fixed,

Screen Shot 2016-03-23 at 14.48.58

So to remove the duplicate I first remove both and then add the one again:

Screen Shot 2016-03-23 at 14.49.52

$env:PSModulePath = $env:PSModulePath –replace “;C:\\Program Files\\WindowsPowerShell\\Modules”

Screen Shot 2016-03-23 at 14.52.54

$env:PSModulePath = $env:PSModulePath + “;C:\Program Files\WindowsPowerShell\Modules”

Happy automating 🙂

SC VMM bare metal deploy with UEFI enabled host

During last week I was working on some bare metal deployment on some Hyper-V hosts with System Center VMM. We had deployed them before using legacy boot but now we had updated the BIOS to latest version and got into some trouble.. Maybe it was because of the HPE instead of the HP 😉

Screen Shot 2016-03-17 at 11.19.02

During the deployment the WinPE got an error and could not connect to the VMM server,

Screen Shot 2016-03-17 at 13.17.02

We tried to update NIC drivers and stuff on the WinPE image but that did not help. During the testing we started the server and configured it to boot with EFI instead of legacy boot and olala it worked to connect to the VMM server but thus as the Hyper-V VHD was MBR we got the following error:

Screen Shot 2016-03-17 at 15.41.29

The easiest way I could think of right there and then was to create my new GPT based VHD to boot the Hyper-V host with a powershell convert script from the original MBR vhd. The script required to be run on a Hyper-V host so I connected to one of the Hyper-V nodes in the test cluster and ran the script on a patched VM that was sysprepped:

Screen Shot 2016-03-17 at 16.02.48

And once that was done I had to update the Physical profile to set the disk to GPT instead of MBR:

Screen Shot 2016-03-17 at 16.23.23

And now the deployment worked nicely all the way!


install-service during bootstrap a windows node with chef knife

I was exploring last week how I could add a managed windows node in my internal test environment where I have a chef server.

Bootstrap a windows node has been possible quite a while but not so long ago the knife windows added the parameter for also setting up the client as a service. This was part of the Knife Windows 1.0 release as you can read on the Chef site.

Screen Shot 2016-03-17 at 08.43.37

Another great parameter now available is the –msi_url that gives the possibility to set the chef client msi path to something local if the servers cannot speak to the mighty Internet

happy chef-ing!

Configure VM Network settings from the host using Hyper-V 2016

Today I used Ravikanth script for configuring an VM´s NIC settings from the host and can confirm that it works nicely also on a Hyper-V Host with 2016 TP4 and a full-GUI VM and also with VM´s running Nanoserver 🙂

There is a cmdlet in the Hyper-V PowerShell module that is named: Set-VMNetworkAdapterFailoverConfiguration although that configures only the nic for the Hyper-V replicated VM and cannot be used on a ordinary vm. So using the function from Ravi I set the VM´s configuration using the Hyper-V WMI virtualization namespace.

Screen Shot 2016-03-01 at 14.53.00

And trying to set it on a Nano server also works nicely

Screen Shot 2016-03-01 at 15.19.58


SCVMM Bare-Metal Deploy errors and PXE error 21164

I was working with a customer yesterday and trying out bare-metal deploy of a Image for their Hyper-V servers, and in this case a brand new Dell R730 with nice specs 🙂

During the deployment we got some errors that we had to handle and I wanted to highlight them so that you can handle them if they appear in your environment one day!

First of we had some issues to enable the NIC to respond to PXE but that had more to do with where to find stuff in the bios and iDRAC settings 😉

But once that was fixed we got the following error and I have already mentioned that in a blog post earlier.

Screen Shot 2016-02-25 at 13.09.47

So trying to update the WinPE image got us into some more trouble, as you can see on the following screen dump. This was a new one that I have not seen before, checking the folders I could not find any strange things but…

Screen Shot 2016-02-25 at 15.25.55

I tested to restart the VMM service just in case and the same error appeared and thus I thought that it might go away if I remove and add the PXE server again and yes that worked!

Screen Shot 2016-02-25 at 15.26.05

And after this we were able to deploy a physical servers as a Hyper-V host!

Finally the AzureStack TP1 bits have arrived!

Yesterday the AzureStack TP1 PoC files was released and now you can play around and create your own Azure. Now I just need a decent hardware to run this!

If you have some issues with the requirements my friend Daniel have made a blog about how you can try to install it with less memory!

Shown below is the diagram of the PoC setup and here you can see all the different roles included for your Azure on premises 🙂


On this page you can read more about it and learn how to deploy it to your environment!

Cool Stuff happening!

So 2016 have started and fun stuff will happen in the near future!

Last week me and the family was in the ski mountains Idre and the rest of the family was skiing but I had a achilles tendon rupture in the christmas weekend so I had to be in the cabin most of the time! Although one evening I got to do some sightseeing on the mountain B-)


Pretty amazing stuff going with a large piste caterpillar and seeing the result!

But more importantly what is happening in the near future:

DevOps Hackathon in CopenHagen 20-21/1

I will be one of the proctors on Rasmus Hald´s DevOps Hackathon that will take place in Microsoft´s office in Copenhagen Denmark. During two days we will do workshops in DevOps stuff.

NIC in Oslo 4-5/2

Me and Fredrik will do two sessions on DevOps and automation with Chef/Azure/PowerShell/ARM during the Nordic Infrastructure Conference

Want to join? sign up here and book your flights

TechXAzure Microsoft Sweden 15-16/2

During the two-day event at Microsoft Sweden´s TechXAzure me self and Fredrik Nilsson will talk about AzureStack,OMS,Chef and Azure

Sign up here

DevOps day Microsoft Sweden 24/2

In this one-day event I will be with some MVP friends Jacob and Mathias and also Fredrik Nilsson where the Swedish Devs and Ops will learn how to become DevOps with Microsoft solutions.

Please join us! this one is free!!

Azure Automation – Hybrid job with custom runas account

Microsoft and the Azure Automation team has made it possible to use a custom account when running a job on a hybrid worker and that is awesome! Originally the jobs runs under the Microsoft Management Agent´s service account context and that is not always wanted.

Screen Shot 2016-01-09 at 13.56.43

As I described in a post that I did some time ago I used a parameter -PScredential with the inlinescript but now I can with the new functionality get the whole job in the right user context, the user should be saved as a credential asset in your automation account! Last year also the possibility to use PowerShell scripts runbooks besides Workflow runbooks!

Screen Shot 2016-01-09 at 13.57.15

Happy automating!

MVP 2016 – Cloud and Datacenter Management

The year of 2016 started in the best of ways when I got the mail every technical community fellow waits for with the subject:

Congratulations 2016 Microsoft MVP!


Dear Niklas Akerlund,

Congratulations! We are pleased to present you with the 2016 Microsoft® MVP Award! This award is given to exceptional technical community leaders who actively share their high quality, real world expertise with others. We appreciate your outstanding contributions in Cloud and Datacenter Management technical communities during the past year.

I am very thankful and happy that I get this for the third year!

And thank you IT-fellow out there that read and follow my content!

The year of 2015 could though have ended in a better way, I played some badminton after christmas and had the unfortunate luck to get a achilles tendon rupture so the first half of 2016 I will be recovering from this..  (typical injury for a male in his 40ies ? )



Download SysCtr 2016 TP4 VHD´s with PowerShell

I have been using and publishing my script for easily download all the VHD´s for evaluating and testing the technical previews of System Center 2016 and now it is time for the TP4! These pre-installed VHD´s make it quite easy to spin up some of the System Center Suite as VM´s on your Hyper-V box within minutes once downloaded.

Here is the script for your convenience and start playing with the new release!