Monthly Archive


Windows 8 Server

Toggling between LAN and Wireless

One of the questions in the recent Scripting Games involved toggling between a wireless and LAN connection. Only one was to be up at any one time.

This can be solved using WMI but becomes hugely simpler in Windows 8/2012 as we get a bunch of cmdlets for working with network adapters.

Using WMI

Get-WmiObject -Class Win32_NetworkAdapter | Measure-Object

I get 15 objects returned on my system – but I’m only interested in 2 of them!

Using the new functionality

PS> Get-NetAdapter | ft -a Name, ifIndex, Status

Name             ifIndex Status
----             ------- ------
Virtual Wireless      21 Disabled
Virtual LAN           12 Up

This leads to a simple piece of code

Get-NetAdapter |
foreach {
  $nic = $_
  switch ($_.Status){
   "Up"        {Disable-NetAdapter -InputObject $nic -Confirm:$false}
   "Disabled"  {Enable-NetAdapter -InputObject $nic -Confirm:$false}


Get the adapter, test its status and toggle to the other.

These cmdlets are in the NetAdapter module which is created using the cmdlets over objects techniques to utilise WMI classes in a much friendlier way. Remoting capabilities are supplied by CIMsessions

Using Windows 2012 Active Directory module in a Windows 2008 R2 domain

A question came up on Tuesdays UK PowerShell Group session about using the Windows 2012 Active Directory module. The recording links are here

The question asked if the new Site, Subnet and Site link cmdlets would work in a legacy environment.

This morning I installed a Windows Server 2012 Release Candidate member server into my Windows 2008 R2 domain. I then installed the RSAT feature on the Windows 2012 server – this includes the Active Directory module.

The site, subnet and site link cmdlets appear to work with NO changes required to the Windows 2008 R2 domain controller. I was able to view and create sites, subnets and site links.

I haven’t tested any other scenario.

Scheduled tasks on clusters

This post shows how to use PowerShell in Windows Server 2012 to configure scheduled tasks that apply across the whole cluster not just a single node

Well worth a read

May 2012 Powershell group recording and slides


The recording, slides and demo scripts from last nights session  - Powershell in Windows Server 8 part 2  - is available from

The full set of historical recordings can be found here:

2011 09 PowerShell remoting and end point customisation
2011 11 Whats new in PowerCLI 5
2011 12 Intro to WMI
2011 12 WSMAN_WMI_and_CIM
2012 January PowerShell v3 CTP 2 overview
2012 February PowerShell and SQL Server
2012 March CIM cmdlets
2012 April Powershell in Windows Server 8
2012 May Powershell in Windows Server 8 part 2 

Older folders just have the slides

May UG meeting reminder

Quick reminder that the UK PowerShell group session on PowerShell in Windows 2012 is on Tuesday 29 May. Details from

UK PowerShell Group–April 2012 slides and recording

The slides, demo script and recording are available from

Thank you again to everyone who attended the Live Meeting this evening

Reminder–UK User group 24 April

Quick reminder that 24 April sees the first of 2 sessions on new PowerShell functionality in Windows 2012 – Windows Server 8

Details from

UK PowerShell Group–24 April 2012

This months meeting is the first of two looking at the new PowerShell functionality in Windows Server 8. Yes, there is so much it will take two sessions!

When: Tuesday, Apr 24, 2012 7:30 PM (BST)

Where: Virtual


This is the first of two meetings looking at the new PowerShell functionality available in Windows Server 8


Richard Siddaway has invited you to attend an online meeting using Live Meeting.
Join the meeting.
Audio Information
Computer Audio
To use computer audio, you need speakers and microphone, or a headset.
First Time Users:
To save time before the meeting, check your system to make sure it is ready to use Microsoft Office Live Meeting.
Unable to join the meeting? Follow these steps:

  1. Copy this address and paste it into your web browser:
  2. Copy and paste the required information:
    Meeting ID: S5NC59
    Entry Code: c^]"2]44W

If you still cannot enter the meeting, contact support

Microsoft Office Live Meeting can be used to record meetings. By participating in this meeting, you agree that your communications may be monitored or recorded at any time during the meeting.

Up coming User group sessions

The sessions for the next few months are:

  • 27 March – PowerShell v3 CIM cmdlets and “cmlets over objects”
  • April – Managing Windows Server 8 with PowerShell
  • May – Managing Windows Server 8 with PowerShell

No thats not a mistake – there is so much new PowerShell functionality in Windows server 8 that two sessions will just scratch the surface.  I’m delivering the April session and PowerShell MVP Jonathan Medd is delivering the May session.

Details on March’s sessions from

As always the session will be recorded and made available afterwards.

Creating a new AD forest

One big change with Windows Server 8 is that dcpromo is no more – its gone, gone gone.

Instead the promotion wizard is started from Server Manager. Install the AD Domain Services role and you will see a notification at the top right of the Server Manager console with a complete Active Directory configuration option.  Click that and the wizard starts. If you’ve used dcpromo on earlier versions of Windows there won’t be any surprises.

Best of all you get the PowerShell commands to do the job

Import-Module ADDSDeployment
Install-ADDSForest `
-CreateDNSDelegation:$false `
-DatabasePath "C:\Windows\NTDS" `
-DomainMode "Win8" `
-DomainName "Beta8.test" `
-DomainNetBIOSName "BETA8" `
-ForestMode "Win8" `
-InstallDNS:$true `
-LogPath "C:\Windows\NTDS" `
-RebootOnCompletion:$true `
-SYSVOLPath "C:\Windows\SYSVOL" `

already to be re-used.  The AD Administrative Centre also produces the PowerShell it uses under the hood but thats a story for another day.

The ADDSDeployment module has a number of cmdlets

PS> Get-Command -Module ADDSDeployment

Capability      Name
----------      ----
Cmdlet          Add-ADDSReadOnlyDomainControllerAccount
Cmdlet          Install-ADDSDomain
Cmdlet          Install-ADDSDomainController
Cmdlet          Install-ADDSForest
Cmdlet          Test-ADDSDomainControllerInstallation
Cmdlet          Test-ADDSDomainControllerUninstallation
Cmdlet          Test-ADDSDomainInstallation
Cmdlet          Test-ADDSForestInstallation
Cmdlet          Test-ADDSReadOnlyDomainControllerAccountCreation
Cmdlet          Uninstall-ADDSDomainController


I’ll be trying out the Install-ADDSDomainController soon