Tag: Powershell

PowerPlan, WMI, GUI and Windows Server 2012

Howdy !

If you try to configure the power plan settings of your servers using DSC, you might come into the below issue if you are using one of the following resource : xPowerPlan or cPowerPlan. They both call WMI classname.

The WMI class ‘Win32_PowerPlan‘ of the namespace ‘root/cimv2/power’ is only available when using a FULL GUI Windows Server 2012 (R2). If you switch to CORE flavor, the classname becomes inaccessible.

At the moment you are using a Core only OS, this classname doesn’t works anymore under Windows 2012 and 2012 R2 except for Windows 2016 Core.

You can quickly check the falvor of your OS with the following cmdlets :

$Computer = ‘yourMachine’
$sb = {
Get-ItemProperty ‘HKLM:\Software\Microsoft\Windows NT\CurrentVersion’ -Name Productname | Select -expa ProductName
Get-Item ‘HKLM:\Software\Microsoft\Windows NT\CurrentVersion\Server\ServerLevels’ | ft -AutoSize

icm -ScriptBlock $sb -ComputerName $Computer



Quickly generate PFX files for the Central Certificate Store from a SAN certificate

  • Define location of the certificate.
     $CertPath = 'C:\MyDisks\Certificates\MyCDN.mydomain.org.pfx' 
  • Load the certificate
     $Cert = Get-PfxCertificate -FilePath $CertPath

    [Enter the password in the credential prompt]

     $Pass = ConvertTo-SecureString -String 'TheSecurePasswordOfCertificate' -AsPlainText -Force
  • Generate the files using the DNS Names of the certificate
     $Cert.DnsNameList | %{Copy-Item -Path $CertPath -Destination C:\MyDisks\TMP\$($_.unicode).pfx}