Building a home lab, the PowerShell way

I haven’t posted here in a while, but for a good reason: I started a new job! As of May 1th, I started working as a Senior IT Consultant at Hands On.
Partly because of the job change, I wanted to build a home lab for some testing an practicing for certification exams.
My lab will run an Intel NUC, the sixth generation, with 32GB of RAM and a 500GB M.2 SSD drive. This box currently runs Windows 10 Pro, mainly because that means I can also use it as workstation while working at home. Perhaps in the future I’ll switch over to running a server OS, with a workstation as a VM… Still thinking about what the best option is.
Anyway, the box runs Hyper-V and because using it as a lab means I’ll frequently be installing new servers or reinstalling existing ones, I wanted a workflow to speed up this process. And of course I will use PowerShell to do so 🙂 I’ll share my setup and scripts in this post, but please note that this is (as always) work in progress and is by no means a perfect solution. However, because I received some requests to share my work, I decided to put them online already 🙂
First, a small look at the networking setup for Hyper-V. I wanted to isolate my guests from my main network. And because the NUC is such a nice, portable little box, I want to have the ability to take it with me and use it somewhere else, without the need to change my entire network configuration. To realize this, I decided to go with a NAT-switch in Hyper-V. This way, the guests can use there entire own subnet and still have internet-access through the host machine. For more information on this, check this out.
To save up on disk space needed for the servers, I wanted to use differencing disks. This way, there is one ‘main’ disk, with each VM having it’s own differencing disk with just the changes / delta’s to the main disk. So, I installed a plain Windows Server 2012 R2, installed all available updates and ran sysprep so I can use this as a base image.
After this, i copied the VHDX for this machine to seperate folder and marked it as read-only. Once it is used as a base disk for all other servers, changing this disk directly would break all underlying VM’s, so the read-only part is just for security.
After this, the ground work for the lab is done. Now i’ll need to build a PowerShell script to do the actual deployment.
I’ll break down the script piece by piece, to show what work is being done by the script.

This first part is where I’ll define the variables that I change whenever I run the script. I set the desired name for the VM, the IP-address I want it to use and the IP-address for the DNS server. In the future, I’ll most likely change this script into a function so I can just supply them as paramaters. For now, I’ll just manually change the script each time I run it. Like I said: work in progress 😉

These are static variables that contain stuff as file paths. These won’t change each time the script is run, but I think setting them here is nicer that just hardcoding them in the script. The ‘CertLab’ VM-Switch is the NAT-switch I created earlier.

The real work starts off with creating the VHD-file for the new server. The disk is created as a differencing disk, with the base image I created earlier as the parent disk.

This part of the script mounts the newly created VHD-file for the new-VM, and then copies an unattend.xml to this disk. I use some scripting to add content to the XML-file. This way I change the hostname, IP-address and DNS server address for the new server, based on the variables I defined in the beginning of the script.

Here, I just create the new VM. I set the MemoryStartupBytes paramater here hardcoded in the script, but ofcourse you can always choose to specify this as a variable (or a parameter if you create a function) to be able to easily change this.

Finaly, I simply start the new VM.

That’s it! By using this script, I’m able to set up a new VM in my lab with just a few clicks. Like I said, it’s work in progress. I’d like to implement PowerShell Direct to do some final configuration on the guest machine, such as adding certain roles. At this time, however, PowerShell direct requires the guest to run a Server 2016 TP OS, and as I’m also using this lab for certification and training purposes, I’m sticking with Server 2012 R2 for now. I could set up PowerShell Remoting (Robert has a great blogpost on this), but that’s something for the future 😉
If you have any comments on my code, or if you would like to add something to the script, please feel free to do so!

Exchange 2010 EMC issue resolved – so it seems

I blogged earlier about an issue when setting up a connection to Office 365 in the Exchange Management Console in Exchange 2010 (in this case, Service Pack 3, Rollup Update 12).

It seems that this issue was resolved. Despite the fact that I didn’t get any further feedback on the ticket I raised at MS Support or within the support forums thread mentioned in my earlier post, I decided to simply give it another try today… And It Just Worked™.

I didn’t change any thing on the existing configuration, just simply tried adding the connection to EMC again. At another client that encountered the same issue (but for which we didn’t raise a ticket yet), the issue seems to be resolved too, which leads to think there was a configuration change on the Office 365 side. However, we will need to wait for official feedback from Microsoft about this issue to have this confirmed.


Exchange 2010 hybrid connection in EMC fails with ‘ExchangeBuild’ error

I ran in to an issue using Exchange 2010 in a Hybrid setup.

In this case, I am running a fully patched Exchange 2010 SP3 CU12 machine, and I ran the new Hybrid Configuration Wizard. This completed successfully, so I do have a working Hybrid setup and should be able to move mailboxes cross-prem and send and receive mail on both sides.

Next step is to add the Office 365 tenant to my Exchange Management Console. To do this, I right-click the ‘Microsoft Exchange’ tree and click the ‘add new forest’ link. After naming the forest and selecting the ‘Exchange Online’ option for the remote PowerShell instance, I need to enter the credentials for my tenant. When validating, the wizard throws an error.

Exchange Error

‘The format of the Exchange object version is wrong. Parameter name: ExchangeBuild’.

After some searching, I found other people running into the same problem. Some get the error when trying to open an existing instance in EMC, some get it when trying to create a new one, like me. For those who get the error on an existing instance, some users report that deleting and re-adding the instance solves the problem. Others can’t re-add the instance after deleting it, facing the same error as me. A MSFT employee responded in the thread, stating that the problem has been found and the Exchange team is working on resolving it. For now, there isn’t a resolution.

The issue is also mentioned on, but aside from two obvious workarounds, there isn’t a solution yet.

For creating the hybrid setup, you can use the new HCW without running in to the issue. For viewing properties for users that are homed on Exchange Online in your hybrid scenario, you can use the Exchange Online console online. However, for the time being, there isn’t a supported way to modify these properties in this scenario.

Edit 3-9-2016: The issue seems to be resolved.


Extra strorage for SharePoint Online

Finally: SharePoint Online storage increase

The future is here! It was announced several times, but Microsoft finally upgraded the default available SharePoint Online storage for an Office 365 tenant to 1TB.

This means that every tenant will get 1TB of pooled storage for SharePoint Online, increased with 500MB for each licensed user. That’s a big upgrade from the previous 10GB + 500MB.

And the best part is that the increased storage is available directly!

Extra strorage for SharePoint Online

I think this is a huge improvement: it makes the Team Sites in SharePoint online a better candidate to store your shared documents, in stead of placing them on OneDrive for Business. And a team site is where those files belong, as OneDrive for Business is designed to be used just for personal files. The increase to 1TB will make that most businesses can start using SharePoint Online without the need for purchasing extra storage.

Talking about OneDrive for Businesss: there is an update there to. Where the current storage limit for OneDrive for Business is 1TB per user, Microsoft is offering unlimited OneDrive for Business storage for premium plans. Other Office 365 plans will get 5TB for each user. The first fase of rolling these upgrades has finished recently.

More information on these changes can be found in this announcement bij Microsoft.


Remove calendar processing from a non-resource mailbox

Today I was working on converting an Office 365 room-mailbox to a ‘regular’ shared mailbox. The customer had some legitimate reasons to convert this mailbox, and who am I to question. 😉

The conversion itself is fairly simple, using PowerShell

This sets the mailbox to a ‘regular’ shared mailbox instead of a room mailbox (what it was). After setting some access rights to the mailbox I emailed the customer that his mailbox was changed and that he could access it.

After a few minutes, I received an email stating that he could send an email to the newly converted shared mailbox, but that the email would be moved to the trash can almost instantly. I know this is the default behavior for room mailbox where the calendar autoprocessing is enabled, so I reverted back to my Powershell window.

This shows that the calendar processing for this mailbox is still active. Apparently, this doesn’t get disabled when converting a room mailbox to a different kind of mailbox. No problem, because we can use the set-calendarprocessing to disable this feature.

Unfortunately, this returns an error:

The error is clear: you can only run this command on a resource mailbox. The solution was also clear: convert the mailbox back to a room mailbox, remove the calendar processing and convert the mailbox to a regular shared mailbox again.

Lessons learned: when converting a room mailbox with calendar processing enabled to a different type of mailbox, remove the calendar processing before converting the mailbox.


Office 365 E5 will bring PSTN calling to The Netherlands before this summer!

Some breaking news at the Office 365 Drumbeat event today! The Office 365 E5 plan has been available for a while, but in The Netherlands, there was no PSTN-calling. You can currently use the PSTN conferencing dial-in, but you can not use your Skype for Business as a cloud based PBX. This will change! Before this summer, PSTN-calling will be available in The Netherlands. This was disclosed at the O365 Drumbeat conference in Amsterdam today.

Liking that? Then maybe this is a good moment to register for the Microsoft Cloud Roadshow, to be held in several cities. The one in The Netherlands will be held on May 19th and 20th in World Forum in The Hague. You can register online.


Getting started with Powershell for Office 365

So, you manage a nice, shiny Office 365 tenant. You use the portal to take care of your admin needs like creating users, assigning licenses and setting permissions.

But you want more. Of course you want more, you’re in IT. You always want more. You no there is one tool that can give you more: Powershell. Like for al modern Microsoft workloads, PowerShell is my go-to tool for Office 365 too. I find myself using PowerShell even for stuff I can do from within the portal, because i’m just simply used to it. Some tasks you can only do in Powershell, so you need to learn it anyway. Back in the days, when Wave14 of Office 365 was still there, you needed Powershell to create a shared mailbox, for example. By now, you can do that from within the portal, but I still find myself using Powershell because i’m used to it.

So, getting started with Powershell. How do you do that? For starters, Microsoft has a site dedicated to this. You can get started with the basic Powershell cmdlets for Office 365, find script examples and watch some Office Mechanics videos on the subject.

Furthermore, when getting started with Powershell in general, the book Learn Windows Powershell in a month of lunches is a no-brainer. In, as the title says, a month of lunches you can get started using Powershell and get to know all tips and tricks. Because it  starts from the basics, you get a solid foundation on the language so you can start building your own scripts and functions.

And last but not least: get in touch with the community. In The Netherlands, there is a very active Dutch Powershell User Group, with regular meetings to boost your knowledge. Not from our little country? No problem. There are Powershell user groups all over the world. Bing it! 😉



One final tip, for when you’re ready to really get your Powershell going: invest in license for IseSteroids. This enhancement for the integrated script editor provides lots of functions to make your live easier. Really worth the money!


Use Outlook or Outlook for the Web?

Just a quick blog post today, on deciding whether you should use Outlook for the Web for you tasks, or you should use the full Outlook desktop client.

As it turns out, there is a complete topic on the Office support pages for this: you can find it here.

There is a quick diagram on when you can use both clients, but also a detailed feature comparison to help you decide what you can use best.