Remote manage a Hyper-V server from a different domain


You can however remove it from its current domain:

netdom remove /d:DomainThatNoLongerExist.COM HYPERVComputerName /FORCE

Then add it in server manager, right click on it and select Manage As… and you can enter the local admin credentials for the Hyper-V box

Still not entirely sure if you need to run this on the management server…

Set-Item WSMan:\localhost\Client\TrustedHosts -Value -Concatenate

Removing Exchange 2010

This assumes that you are removing the LAST Exchange 2010 Server in a domain after moving to Office 365…

DISABLE the Mailboxes, be careful the other option bins the AD user object as well!!

Delete all User Public folders:
$ExchangeServer = "ServerName"
Get-PublicFolder -Server $ExchangeServer "\" -Recurse -ResultSize:Unlimited | Remove-PublicFolder -Server $ExchangeServer -Recurse -ErrorAction:SilentlyContinue

Delete all System Public folders:
Get-PublicFolder -Server $ExchangeServer "\Non_Ipm_Subtree" -Recurse -ResultSize:Unlimited | Remove-PublicFolder -Server $ExchangeServer -Recurse -ErrorAction:SilentlyContinue

Delete the Default Offline Address Book.

Delete the Mailbox Databases

Check if a specific mailbox database that you cannot remove through EMC contains a mailbox and what type they are:
get-mailbox -database "Mailbox Database"
get-mailbox -database "Mailbox Database" -archive
get-mailbox -database "Mailbox Database" -arbitration

Assuming that there are arbitration mailboxes, this is how you remove them:
get-mailbox -database "Mailbox Database" -arbitration | disable-mailbox -arbitration -disablelastarbitrationmailboxallowed

Remove any Send Connectors (Organisation Configuration > Hub Transport > Send Connectors)

Uninstall Exchange from Programs and Features.

Bulk AD Updates on OU

Posting this as I always bloody forget it!

import-module ActiveDirectory
Get-ADUser -SearchBase 'ou=users,dc=company,dc=local' -Filter * | Foreach-Object{
$firstname = $_.givenname
$lastname = $_.surname
$domain = ""
$emailaddress = $firstname + "." + $lastname + $domain
Set-ADUser -Identity $_ -Email $emailaddress

Convert VHDx Files

Example to convert from a dynamic to a fixed VHDx file:

Convert-VHD -path "C:\Hyper-V\server-1.VHD" -destinationpath "C:\Hyper-V\server-2.VHD" -vhdtype fixed

Once the VHDx has been altered the new file will not contain the correct permissions. If you rename the new VHDx to the same as the old file (after renaming the old one) then the Virtual Machine will not boot. If you examin the permissions of the two files you will see the differences. The simplest way to correct the permissions is to add the new VHDx through Hyper-V manager (or if you have renamed the VHDxs simply remove and re-add the Hard Drive in Hyper-V manager).