Monthly Archive

Categories

Windows 2012 R2

Windows Server 2012 R2 Update

The Windows Server 2012 R2 Update (and the corresponding Windows 8.1 Update) are available to MSDN/TechNet subscribers. General availability follows on 8 April (patch Tuesday)

Details from http://blogs.technet.com/b/windowsserver/archive/2014/04/02/windows-server-2012-r2-update-is-now-available-to-subscribers.aspx

Windows Management Framework V5

The Windows Server blog has an announcement, and download link, for WMF v5. 

http://blogs.technet.com/b/windowsserver/archive/2014/04/03/windows-management-framework-v5-preview.aspx

The headline items are OneGet and cmdlets for managing network switches that conform to the Certified for Windows Network program.

OneGet is a way to discover, and install, software packages. In this release you can search for and install software from Chocolatey repositories.

There are also some fixes and enhancements to DSC to improve performance.

DSC resource kit wave 3

Desired State Configuration (DSC) is the new server configuration and compliance mechanism that ships with PowerShell 4.0 and Windows Server 2012 R2.

Resources are the way you perform configuration. Now you have more options with the release of wave 3 of the DSC resource kit.

Details from http://blogs.msdn.com/b/powershell/archive/2014/03/28/dsc-resource-kit-wave-3.aspx

DSC, Windows 2012 R2 and GA

Windows 2012 R2 GA (General Availability) occurred in October 2013. Downloads of the Windows 2012 R2 RTM release were made available on MSDN before that time however there were some changes made between RTM and GA that have a significant impact on Desired State Configuration – it breaks on most code you will find.

The answer is to install some updates.

As an absolute bare minimum you should install the GA update – KB2883200 (Note that KB 2894029 and KB 2894179  are included in the KB2883200 download)

http://support.microsoft.com/kb/2883200

http://www.microsoft.com/en-us/download/details.aspx?id=40774

 

When you install Windows 2012 R2 check that KB2883200 has bee installed. If not download and install.

I’d also recommend that you install KB2884846 (you also get KB2898742) – the October 2013 update rollup.

http://support.microsoft.com/kb/2884846

http://www.microsoft.com/en-us/download/details.aspx?id=40771

 

There is also a March 2014 update rollup -  KB2928680 – this important because it fixes the AD cmdlet issue

http://support.microsoft.com/kb/2928680

http://www.microsoft.com/en-us/download/details.aspx?id=42160

 

If you want to get the best out of Windows 2012 R2 make sure you install these updates. Matching updates are available for Windows 8.1 as well.

Get-ADUser issue fixed with hotfix

The issue that I discussed in these posts:

http://richardspowershellblog.wordpress.com/2013/11/08/get-aduser-issue-2/

http://richardspowershellblog.wordpress.com/2013/11/06/get-aduser-issue/

With Get-ADUser and –Properties * in a forest level below 2012 R2 has been resolved  in this update:

http://support.microsoft.com/kb/2923122

VM disk info

A question came into the forum about getting information on the virtual disks associated with particular Hyper-V virtual machines. Is a bit of a digging exercise but this gets the results:

Get-VM |
foreach {
$VMname = $psitem.Name
Get-VMHardDiskDrive -VMName $VMname  |
foreach {
   Get-VHD -Path $_.Path |
   select @{N='VMname'; e={$VMName}}, Path, Size, FileSize
}
}

Get the set of VMs and for each of them get the VMHardDisks associated with the machine. For each VMHardDisk get the VHD – this is where you find the data you need.

 

The size and file size are in bytes – its a simple matter to create calculated fields that divide by 1GB or percentages if you require

Test windows activation

I’m currently upgrading my lab environment to Windows Server 2012 R2 which involves upgrading some machines and rebuilding the others.  One task in any build or upgrade situation is to make sure that Windows is activated.

Windows Server 2012 R2 will activate once an Internet connection is established. This can sometimes take a few minutes. Rather than keep checking in the GUI I wrote a little function to do the job for me:

function test-activation {
  $slp = Get-CimInstance -ClassName SoftwareLicensingProduct -Filter "PartialProductKey LIKE '%'"
  if ($slp.LicenseStatus -eq 1) {
    return "$($slp.Name) on $env:COMPUTERNAME is activated"
   }
   else {
    return "$($slp.Name) on $env:COMPUTERNAME is NOT activated"
   }
}

This is based on technique 104 in PowerShell and WMI  - www.manning.com/siddaway2

Get-CimInstance  uses the SoftwareLicensingProduct class and filters on the PartialProductKey property. The filter only picks up those instances where the property has a value.

If the LicensesStatus property equals its activated otherwise it isn’t.

Get-ADUser issue fixed

I reported in this post http://richardspowershellblog.wordpress.com/2013/11/06/get-aduser-issue/ an issue with Get-ADUser under PowerShell 4.0 on Windows 8.1/2012 R2 where using –Properties * caused a failure.

I had a comment that this is schema related and a schema upgrade fixes the problem.

My starting point is a Windows 20012 domain

£> Get-ADDomain | ft DomainMode -a

       DomainMode
       ----------
Windows2012Domain

And I have schema version 56

On a Windows 2012 R2 member server I try get-aduser

£> Get-ADUser -Identity richard -Properties *
Get-ADUser : One or more properties are invalid.
Parameter name: msDS-AssignedAuthNPolicy
At line:1 char:1
+ Get-ADUser -Identity richard -Properties *
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (richard:ADUser) [Get-ADUser], ArgumentException
    + FullyQualifiedErrorId : ActiveDirectoryCmdlet:System.ArgumentException,Microsoft.ActiveDirectory.Management.Comm
   ands.GetADUser

Now lets try the schema upgrade – looks like it goes to  version 69 – that’s quite a big upgrade. Once the upgrade has been performed – let the schema replication occur & reboot the Windows 2012 R2 member server just to make sure nothing is cached that could affect the result.

Now to re-try Get-AdUser

Get-ADUser -Identity richard -Properties *
Get-ADUser -Identity richard -Property *

Both work – we have a winner.  If you are seeing this problem the answer is to upgrade your schema.  You don’t need to upgrade the Domain Controllers just the schema.

Its a bit naught that this happens – I don’t remember similar problems putting a Windows 8/2012 machine with PowerShell 3.0 into a Windows 2008 r2 domain

Get-ADUser issue

By default Get-ADUser returns a limited number of properties.  If you wanted to see all properties on a user account you would do this

Get-Aduser –Identity richard –Properties *

This option appears to be broken in Windows 2012 R2 / PowerShell 4

PS C:\Windows\system32> Get-ADUser -Identity richard -Properties *

Get-ADUser : One or more properties are invalid.
Parameter name: msDS-AssignedAuthNPolicy
At line:1 char:1
+ Get-ADUser -Identity richard -Properties *
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (richard:ADUser) [Get-ADUser], ArgumentException
    + FullyQualifiedErrorId : ActiveDirectoryCmdlet:System.ArgumentException,Microsoft.ActiveDirectory.Management.Commands.GetADUser

You can work round the problem like this:

Get-ADUser -Identity richard| Get-ADObject -Properties *

AD Month of Lunches–Chapt 18 & 19 in MEAP

An updated MEAP has been released for Active Directory Management in a Month of Lunches.  This one adds chapters 18 & 19

  • Chapter 18, "Managing AD trusts"
  • Chapter 19, "Troubleshooting your AD"

The MEAP is available from www.manning.com/siddaway3

Enjoy