change windows 2012 to core mode

downloadFound yourself considering hyper-v? Microsoft has come a long way and is now becoming more popular as a serious contender in the hypervisor area. My preference is still VMware, but some businesses may find their Microsoft allegiance makes hyper-v a valid option.

Note, i do not consider Microsoft a “cheaper” solution in any circumstance. The current state of hyper-v, SDN options, clustering and VMM management falls very short of what VMware has out of the box. Anyhow, if you do choose windows, here is how you remove the GUI – hopefully saving you a little bit of RAM and reducing the running footprint open for attacks and vulnerabilities….



Powershell commands to convert between the following windows modes;

Full Server -> Server Core with GUI Management (Minimal Server Interface)

Uninstall-WindowsFeature Server-Gui-Shell -Restart

Full Server -> Server Core

Uninstall-Windowsfeature Server-Gui-Mgmt-Infra -Restart

Uninstall-WindowsFeature Server-Gui-Shell -Restart

Server Core -> Full Server

Install-WindowsFeature Server-Gui-Shell -Restart

Server Core with GUI Management (Minimal Server Interface) -> Full Server

Install-WindowsFeature Server-Gui-Shell -Restart

Note : always use windows firewall. If possible also consider AV solution to further protect your hosts.

activate windows from command line – slmgr

Temporarily extend evaluation period (limited execution – see output below)…

C:\Windows\System32>cscript slmgr.vbs /rearm

C:\Windows\System32>shutdown -r -t 1

Show detailed license information…

C:\Windows\System32>cscript slmgr.vbs /dlv

License Status: Initial grace period
Time remaining: 43200 minute(s) (30 day(s))
Remaining Windows rearm count: 0

Activate windows…

C:\Windows\System32>cscript slmgr.vbs /ipk xxxxx-xxxxx-xxxxx-xxxxx-xxxxx

C:\Windows\System32>cscript slmgr.vbs /ato

Will require access to the internet – most of the time the issues are either time sync or connectivity to internet. Windows activation fails and may generate error code 0x8004FE33

To do this, configure the following list of CRLs to be unauthenticated on the proxy server:

windows 2012 change key from evaluation to standard

get current version;

dism /online /get-currentedition

Deployment Image Servicing and Management tool
Version: 6.2.9200.16384

Image Version: 6.2.9200.16384

Current edition is:

Current Edition : ServerStandardEval

dism /online /set-edition:ServerStandard /ProductKey:xxxxx-xxxxx-xxxxx-xxxxx-xxxxx /AcceptEula

Deployment Image Servicing and Management tool
Version: 6.2.9200.16384

Image Version: 6.2.9200.16384

Starting to update components…
Starting to install product key…
Finished installing product key.

Removing package Microsoft-Windows-ServerStandardEvalEdition~31bf3856ad364e35~amd64~~6.2.9200.16384
Finished updating components.

Starting to apply edition-specific settings…
Finished applying edition-specific settings.

The operation completed successfully.
Restart Windows to complete this operation.
Do you want to restart the computer now? (Y/N)

note : you must change evaluation edition to standard before promoting to a domain controller. you cannot change a DC in eval mode to standard and are forced to demote the server before changing the edition.

windows 2012 – dedup

If you have some archive data that you would like to copy onto a  win 2012 server, but dont know how to estimate the end volume size (if VM etc). Start small – about 1/2 of the total capacity of the drive. Robocopy the data onto the drive until nearly full, manually run dedupe, wait until complete, continue robocopy, repeat and rinse. There will be occasions where you will run out of disk space at that point its time to extend your disk.

You will need to enable deduplication on the file server, either hit the GUI or use the following to enable the module;

Import-Module ServerManager
Add-WindowsFeature -name FS-Data-Deduplication

The powershell commands that you’ll use;

Enable-DedupVolume E:
(enables E drive for deduplication)

Set-DedupVolume E: -MinimumFileAgeDays 0
(default is 5 days – which may be sufficient for achival type files)

Start-DedupJob E: –Type Optimization
(manually starts dedup on E drive)

(shows status of currently running dedup and scheduled dedup jobs)

I have used the following powershell script to continually run the dedup process on my archive drive (during migration work). Checks if dedup processes are running – if not execute dedup on archive drive.

$x = 1
while ($x = 1)
$dedupcheck = Get-Dedupjob | Out-String;
if ($dedupcheck -eq "") {
echo "starting dedup process on F drive";
Start-DedupJob F: -type Optimization;
echo "dedup jobs running - sleeping for 2 min";
sleep 120;
echo "";
echo "";

KMS count

Getting the KMS count up over the initial threshold is a pain when you only have one server or one workstation to start with. Typically you need at least 5 servers or 25 client machine requesting activation before it will work.

This guy here as created a nice .exe that will trick KMS into thinking it has received all the required requests…

KMS Client

Using netsh to create a transparent proxy

There are some good windows web proxies about. The only problem with them is they sometimes dont natively act as a transparent proxy. i.e. typically you’ll need to set your client machines to a specific IP and port.

I’ve used squid historically when setting up transparent proxies (mainly since it actually has a transparent mode) and this has worked well. Recently i thought i’d have a go at some of the windows solutions to see how they pan out.

netsh is going to be the tool to assist in this case. Here is a typical use for netsh;


>add v4tov4 listenport=80 connectaddress=  connectport=8080

This should grab all traffic that hits your machine bound for port 80 and redirect to port 8080.

You’ll also need to make sure that routing is enabled, so your machine can act as a gateway between the requests and the real outbound gateway (typically your dsl modem)

enable TRIM in windows 7

This command will confirm if TRIM has been auto-enabled by windows 7

fsutil behavior query disabledeletenotify

DisableDeleteNotify = 1 (Windows TRIM commands are disabled)
DisableDeleteNotify = 0 (Windows TRIM commands are enabled)

If you would like to force it on;

fsutil behavior set disabledeletenotify 0

VirtualBox – crashing / freezing

I’ve had some problems since my upgrade to virtualbox 2.2.0 on OpenSolaris. After some time all of my linux boxes seem to just die. The virtual machine just stops responding. Strangely there was no problem with my windows vms after the update.

From what i can tell it looks like the upgrade turned off “IO APIC” – this is the bit that seemed to cause the problem. Re-enabling this on all of my linux boxes seems to have fixed the problem. I’ll continue testing for another week and update this post if any problems re-occur.

Updated : 01/09/2009

Here is a bit more on IO APIC from the virtualbox wiki…  (from a windows perspective)

The hardware dependent portion of the Windows kernel is dubbed “Hardware Abstraction Layer” (HAL). While hardware vendor specific HALs have become very rare, there are still a number of HALs shipped by Microsoft. Here are the most common HALs (for more information, refer to this article:

Hal.dll (Standard PC)
Halacpi.dll (ACPI HAL)
Halaacpi.dll (ACPI HAL with IO APIC)

If you perform a Windows installation with default settings in VirtualBox, Halacpi.dll will be chosen as VirtualBox enables ACPI by default but disables the IO APIC by default. A standard installation on a modern physical PC or VMware will usually result in Halaacpi.dll being chosen as most systems nowadays have an IO APIC and VMware chose to virtualize it by default (VirtualBox disables the IO APIC because it is more expensive to virtualize than a standard PIC). So as a first step, you either have to enable IO APIC support in VirtualBox or replace the HAL. Replacing the HAL can be done by booting the VM from the Windows CD and performing a repair installation.

Updated : 5/09/2009

I’ve had even more problems with opensolaris crashing completely after upgrading to the newer versions of virtualbox (3.0.4), and have since reverted back to 2.2.0 which has fixed alot of the hanging issues i have encountered

Using W2k3 R2 / W2k8 server as a NFS share for vmware

This is something i do in the lab so all of my vm’s are able to access iso’s etc (very handy for quick builds). Quite handy doing it through windows since its easiey enough to setup a windows network share to the same location and update various files via that.

This site has some good clear instructions :

  1. On the Windows 2003 Server make sure “Microsoft Services for NFS” in installed. If not you need to add it under Add/Remove Programs, Windows
    Components, Other Network File and Print Services
  2. Next go to folder you want to share and right-click on it and select Properties
  3. Click on the NFS Sharing tab and select “Share this Folder”
  4. Enter a Share Name, check “Anonymous Access”
  5. In VirtualCenter, select your ESX server and click the “Configuration” tab and then select “Storage”
  6. Click on “Add Storage” and select “Network File System” as the storage type
  7. Enter the Windows Server name, the folder (share) name and a descriptive Datastore Name
  8. Done. Now you can map CD iso’s to your various vm’s.


This is similar in windows 2008 — screenshots of settings below…

Diskpart – resizing virtual machine system volumes (windows)

Diskpart works quite well extending disk sizes – …unless its the system disk that you need to extend.

Luckily in the virtual world its somewhat easier to move your disks about. This is a quick list of the steps required to increase your system disk… 

You will need to have another virtual machine available to boot into (windows 2003 etc) 

  1. Shut down the virtual machine with the system disk you wish to extend
  2. Go into virtual machine settings and increase the system drive size to what you require
  3. Now you need your spare w2k3 virtual machine or similar. While it is in a shutdown state add the system disk you wish to extend into this machine as another hard disk. Note: select “existing harddrive” and not the default option of  “new harddrive”, and point to the system drive you wish to extend (It is possible to attach this disk as long it is not on and being used) 
  4. Power up the spare machine with the newly attached hard drive (the drive you wish to extend) 
  5. Logon, open up cmd prompt and type “diskpart” 
  6. Now you need to find and select your disk. Type “list disk” to see available disk numbers (most likely the last drive letter). Then type “select disk #”   (# = the number you got from the list command)
  7. Next select the volume, similar to above type “list volume” then “select volume #
  8. Type “extend”
  9. Type “exit” 
  10. Done – shutdown the machine and disconnect the drive you just extended. Be carefull not to DELETE the drive, you only want to disconnect it. 
  11. Now you should be able to fire up the original machine and it will have a larger system drive. 

There are obviously other 3rd party utilities to do this but this is handy to know and is actually quite fast.