ConfigMgr : Windows PE initialization failed with error code 0x80220014

When using System Center Configuration Manager 2012 R2 SP1 and Windows ADK for Windows 10, version 1511 there is a bug which will prevent a production OS booting into a Windows PE environment successfully – you’ll be presented, as I was, with the following error:

Windows PE initialization failed with error code 0x80220014

For now, use the RTM version of the Windows ADK for Windows 10, direct download link here: http://download.microsoft.com/download/8/1/9/8197FEB9-FABE-48FD-A537-7D8709586715/adk/adksetup.exe

More details here: http://blogs.technet.com/b/configmgrteam/archive/2015/11/20/issue-with-the-windows-adk-for-windows-10-version-1511.aspx

Be warned though, this will break DaRT image creation – you’ll get the error below when using the slightly older Windows 10 ADK:

Set-DartImage : Error applying Dart Tools to the image mounted to:

'<image path>'. Package is not applicable: 'C:\Program Files(x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\WinPE-FMAPI.cab'..

At X:\Dart10\DaRT10\x64\DaRT10.ps1:86 char:11

+ $config | Set-DartImage -Path $TempMountPath

+           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : InvalidOperation: (C:\Program File...WinPE-FMAPI.cab:FileInfo) [Set-DartImage], DismPackageNotApplicableException

    + FullyQualifiedErrorId : WindowsPackageNotApplicable,Microsoft.Dart.Commands.SetDartImageCommand

 

ConfigMgr : Are you cleaning up your WIMs?

In a quest to reduce WIM size I came across a couple of tricks that gave me a ~25% reduction (YMMV) in my master image size for a Windows 8.1 build.

  •     Without these steps my base images was 4,796,105 KB
  •     After these steps my base images was 3,732,024 KB

Note that both of the below tricks also work on Windows 10 task sequences, but will not work on Windows 7 task sequences without the following update: https://support.microsoft.com/en-us/kb/2852386

 

Trick 1: DISM Cleanup-image and ResetBase

The first trick is a simple “Run Command Line” task that you can build into a a Task Sequence, just before you reboot back into Windows PE

Command line: Dism.exe /online /Cleanup-Image /StartComponentCleanup /ResetBase

DISM Cleanup

Trick 2: Disk Cleanup Utility

All credit for this goes to the following article: http://stealthpuppy.com/cleaning-up-and-reducing-the-size-of-your-master-image/

For this you will need to create a package that contains a single file names “_ImageCleanup.cmd” the contents of this file should be as below:

REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Active Setup Temp Folders" /v StateFlags0100 /d 2 /t REG_DWORD /f
REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\BranchCache" /v StateFlags0100 /d 2 /t REG_DWORD /f

REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Downloaded Program Files" /v StateFlags0100 /d 2 /t REG_DWORD /f

REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\GameNewsFiles" /v StateFlags0100 /d 2 /t REG_DWORD /f

REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\GameStatisticsFiles" /v StateFlags0100 /d 2 /t REG_DWORD /f

REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\GameUpdateFiles" /v StateFlags0100 /d 2 /t REG_DWORD /f

REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Internet Cache Files" /v StateFlags0100 /d 2 /t REG_DWORD /f

REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Memory Dump Files" /v StateFlags0100 /d 2 /t REG_DWORD /f

REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Offline Pages Files" /v StateFlags0100 /d 2 /t REG_DWORD /f

REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Old ChkDsk Files" /v StateFlags0100 /d 2 /t REG_DWORD /f

REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Previous Installations" /v StateFlags0100 /d 2 /t REG_DWORD /f

REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Recycle Bin" /v StateFlags0100 /d 2 /t REG_DWORD /f

REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Service Pack Cleanup" /v StateFlags0100 /d 2 /t REG_DWORD /f

REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Setup Log Files" /v StateFlags0100 /d 2 /t REG_DWORD /f

REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\System error memory dump files" /v StateFlags0100 /d 2 /t REG_DWORD /f

REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\System error minidump files" /v StateFlags0100 /d 2 /t REG_DWORD /f

REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Temporary Files" /v StateFlags0100 /d 2 /t REG_DWORD /f

REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Temporary Setup Files" /v StateFlags0100 /d 2 /t REG_DWORD /f

REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Temporary Sync Files" /V StateFlags0100 /d 2 /t REG_DWORD /f

REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Thumbnail Cache" /v StateFlags0100 /d 2 /t REG_DWORD /f

REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Update Cleanup" /v StateFlags0100 /d 2 /t REG_DWORD /f

REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Upgrade Discarded Files" /v StateFlags0100 /d 2 /t REG_DWORD /f

REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\User file versions" /v StateFlags0100 /d 2 /t REG_DWORD /f

REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Windows Defender" /v StateFlags0100 /d 2 /t REG_DWORD /f

REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Windows Error Reporting Archive Files" /v StateFlags0100 /d 2 /t REG_DWORD /f

REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Windows Error Reporting Queue Files" /v StateFlags0100 /d 2 /t REG_DWORD /f

REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Windows Error Reporting System Archive Files" /v StateFlags0100 /d 2 /t REG_DWORD /f

REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Windows Error Reporting System Queue Files" /v StateFlags0100 /d 2 /t REG_DWORD /f

REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Windows ESD installation files" /v StateFlags0100 /d 2 /t REG_DWORD /f

REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Windows Upgrade Log Files" /v StateFlags0100 /d 2 /t REG_DWORD /f

IF EXIST %SystemRoot%\SYSTEM32\cleanmgr.exe START /WAIT cleanmgr /sagerun:100

Implement within your Task Sequence as below:

Disk Cleanup Step

ConfigMgr : “Cannot edit the object, which is in use by ” at Site ”.”

I ran into some issue with the ConfigMgr console in a development environment and the console itself bombed-out – at the time I had a Task Sequence open. Upon re-opening the console and trying to edit the Task Sequence I was presented with the following error:

"Cannot edit the object, which is in use by '<user>' at Site '<site>'."

To resolve, you’ll need to open a SQL Server Management Studio connection to your site database. Now execute the following commands to review current locks in your environment:

USE CM_<Site Code>

SELECT * from SEDO_LockState where LockStateID <> 0

Once the Lock ID has been identified, remove it using the following command:

DELETE from SEDO_LockState where LockID = '<lock ID>'

Resetting Surface Pro 3 via MS Supplied Recovery Media

Unsurprisingly the Windows 10 Technical Preview (build 10130) was very unstable on my Surface Pro 3 128GB/i5/4GB – primarily I was plagued with Intel Video Driver crashes, plain grey/white screens and WiFi issues – hey it is a technical preview after-all! Restoring back to a previous version of Windows (i.e. Windows 8.1) requires recovery media, luckily Microsoft supply this for you, as outlined in the following location: https://www.microsoft.com/surface/en-us/support/warranty-service-and-recovery/downloadablerecoveryimage

Once you have download the image use the following instructions to create the media:

  1. Insert your FAT32 USB drive into the USB port of your Surface or PC. For Surface Pro models and Surface 3, your USB drive should be at least 16 GB.
  2. From the desktop, open File Explorer.
  3. Tap and hold (or right-click) on the USB drive, and choose Format.
  4. Select FAT32 as the file system and enter a Volume label (for example, Recovery) to name the USB drive, and tap or click Start.
  5. Tap or click OK to erase the contents of the USB drive.
  6. Tap or click OK when the format is complete.
  7. Double click the recovery image that you downloaded to open and unzip (extract) the files.
  8. Next, drag the files from the compressed folder to the USB drive you formatted.

Finally, follow instructions here to restore the device using the recovery media: https://www.microsoft.com/surface/en-us/support/warranty-service-and-recovery/usbrecovery

Let’s hope these kinks are worked out in the final release 🙂

Lync 2013 : High svchost.exe Handle Count on Front End/Edge Servers

Ran into some stability issues with a Lync 2013 environment recently with calls being dropped and content sharing not working. Restarting the Edge Servers, and less commonly the Front End servers, resolved the issue but only for a few days at most.

Working with MS support they identified high namespace handle count against an svchost.exe process – the process that was associated with WMI. To identify this, WMI was broken out into it’s own svchost process using the information in the following article: http://blogs.technet.com/b/askperf/archive/2014/08/12/wmi-how-to-troubleshoot-high-cpu-usage-by-wmi-components.aspx

Once the cause was identified, the following hotfix resolved the stability issues: https://support.microsoft.com/en-in/kb/2889748/en-us

Windows 2012 R2 : Configure a Network Adapter Using PowerShell

In my quest to automate Windows 2012 R2 deployment (along with SQL 2014 and SharePoint 2013) I wanted to simplify the static IP addressing of my deployed VMs. The following PowerShell commands below will configure the default Network Adapter – always named “Ethernet” in a standard windows 2012 R2 deployment – the script can be easily modified to suit your environment/IP addressing requirements:

$nic = Get-NetAdapter -Name Ethernet
$nic | Set-NetIPInterface -Dhcp Disabled
$nic | New-NetIPAddress -IPAddress 192.168.0.201 -PrefixLength 24 –DefaultGateway 192.168.0.1
Set-DnsClientServerAddress -InterfaceAlias "Ethernet" -ServerAddresses "192.168.0.1"

Windows 2012 R2 : Script to Rename Computer Based Upon Hyper-V Guest Name

I came across the following TechNet post recently which is useful for deploying Hyper-V machines and automating machine renaming to be in-line with the names given to you Hyper-V guests:https://gallery.technet.microsoft.com/scriptcenter/Automate-Virtual-Machine-6c17929c

However, I ran into issues when testing on a Windows 2012 R2 Hyper-V Server and Windows 2012 R2 guest, so modified the rename component as follows – ensure you run from within the guest Operating System:

$virtualmachinename= (Get-ItemProperty 'HKLM:\software\microsoft\virtual machine\guest\parameters').virtualmachinename 
Rename-Computer -NewName $virtualmachinename.ToUpper()
Restart-Computer

Windows 2012 R2 : Forgot to Install the GUI?

In automating the deployment of some Windows 2012 R2 servers on a lab I neglected to select the ‘with GUI’ option during Windows Setup, use the script below to restore the GUI:

Powershell
Install-WindowsFeature Server-Gui-Mgmt-Infra, Server-Gui-Shell -Source:wim:D:\sources\install.wim:2
Restart-Computer

SharePoint 2013 : Script to Download Pre-Requisites for Offline Install

In automating a SharePoint 2013 SP1 deployment on Windows Server 2012 R2 I came across the following PowerShell script to facilitate offline deployment of all Shareoint 2013 SP1 pre-requisites: https://gallery.technet.microsoft.com/office/DownloadInstall-SharePoint-e6df9eb8

The only issue with this script is that it is for Windows 2012 / SharePoint 2013 RTM only.

The modified copy below facilitates all Windows 2012 R2 / SharePoint 2013 SP1 pre-requisite downloads – including naming of the downloads as required by the pre-requisite installer.

{code lang:text showtitle:false lines:false hidden:false}#***************************************************************************************
# Written by Craig Lussier - http://craiglussier.com
#
# Udated for Windows 2012 R2/SharePoint 2013 SP1 by Chris Bradford - http://www.cb-net.co.uk
#
# This script downloads SharePoint 2013 Prerequisites
#
# -Only run this script on Windows Server 2012 (RTM, either Standard or Datacenter)
# -Do not run this script on a Windows Server 2008 R2 SP1 Server!
# ---These are the Prerequisites for Windows Server 2012
# -Run this script as a local server Administrator
# -Run PowerShell as Administrator
#
# Don't forget to: Set-ExecutionPolicy RemoteSigned
# If you have not done so already within you Windows Server 2012 server
#****************************************************************************************
param([string] $SharePoint2013Path = $(Read-Host -Prompt "Please enter the directory path to where you wish to save the SharePoint 2013 Prerequisite files."))

# Import Required Modules
Import-Module BitsTransfer

# Specify download url's for SharePoint 2013 prerequisites
$DownloadUrls = (
         "http://download.microsoft.com/download/9/1/3/9138773A-505D-43E2-AC08-9A77E1E0490B/1033/x64/sqlncli.msi", # Microsoft SQL Server 2008 R2 SP1 Native Client
         "http://download.microsoft.com/download/E/0/0/E0060D8F-2354-4871-9596-DC78538799CC/Synchronization.msi", # Microsoft Sync Framework Runtime v1.0 SP1 (x64)
         "http://download.microsoft.com/download/A/6/7/A678AB47-496B-4907-B3D4-0A2D280A13C0/WindowsServerAppFabricSetup_x64.exe", # Windows Server App Fabric
         "http://download.microsoft.com/download/7/B/5/7B51D8D1-20FD-4BF0-87C7-4714F5A1C313/AppFabric1.1-RTM-KB2671763-x64-ENU.exe", # CU 1 for AppFabric 1.1 (KB2671763)
         "http://download.microsoft.com/download/7/B/5/7B51D8D1-20FD-4BF0-87C7-4714F5A1C313/AppFabric1.1-RTM-KB2671763-x64-ENU.exe", # Cumulative Update Package 1 for Microsoft AppFabric 1.1 for Windows Server (KB2671763)
         "http://download.microsoft.com/download/D/7/2/D72FD747-69B6-40B7-875B-C2B40A6B2BDD/Windows6.1-KB974405-x64.msu", #Windows Identity Foundation (KB974405)
         "http://download.microsoft.com/download/0/1/D/01D06854-CA0C-46F1-ADBA-EBF86010DCC6/rtm/MicrosoftIdentityExtensions-64.msi", # Microsoft Identity Extensions
         "http://download.microsoft.com/download/9/1/D/91DA8796-BE1D-46AF-8489-663AB7811517/setup_msipc_x64.msi", # Microsoft Information Protection and Control Client
         "http://download.microsoft.com/download/8/F/9/8F93DBBD-896B-4760-AC81-646F61363A6D/WcfDataServices.exe", # Microsoft WCF Data Services 5.0
         "http://download.microsoft.com/download/1/C/A/1CAA41C7-88B9-42D6-9E11-3C655656DAB1/WcfDataServices.exe" # Microsoft WCF Data Services 5.6 (rename this download to WcfDataServices56.exe)
	)

function DownLoadPreRequisites() {
	Write-Host ""
	Write-Host "====================================================================="
	Write-Host " Downloading SharePoint 2013 Prerequisites Please wait..."
	Write-Host "====================================================================="
	$ReturnCode = 0

	foreach ($DownLoadUrl in $DownloadUrls) {
		## Get the file name based on the portion of the URL after the last slash
		If ($DownloadUrl -eq "http://download.microsoft.com/download/1/C/A/1CAA41C7-88B9-42D6-9E11-3C655656DAB1/WcfDataServices.exe") {$filename = "WcfDataServices56.exe"}
    Else {$FileName = $DownLoadUrl.Split('/')[-1]}

	Try {
		## Check if destination file already exists
		If (!(Test-Path "$SharePoint2013Path\$FileName")){
			## Begin download
			Start-BitsTransfer -Source $DownLoadUrl -Destination $SharePoint2013Path\$fileName -DisplayName "Downloading `'$FileName`' to $SharePoint2013Path" -Priority High -Description "From $DownLoadUrl..." -ErrorVariable err
		If ($err) {Throw ""}}
		Else {
			Write-Host " - File $FileName already exists, skipping..."
			}
		}
		Catch {
			$ReturnCode = -1
			Write-Warning " - An error occurred downloading `'$FileName`'"
			Write-Error $_
			break
			}
		}
	Write-Host " - Done downloading Prerequisites required for SharePoint 2013"
	return $ReturnCode
	}

function CheckProvidedDownloadPath() {
	$ReturnCode = 0
	Try {
		# Check if destination path exists
		If (Test-Path $SharePoint2013Path) {
			# Remove trailing slash if it is present
			$script:SharePoint2013Path = $SharePoint2013Path.TrimEnd('\')
			$ReturnCode = 0
		}
	Else {
		$ReturnCode = -1
		Write-Host ""
		Write-Warning "Your specified download path does not exist. Please verify your download path then run this script again."
		Write-Host ""
		}
	}
	Catch {
		$ReturnCode = -1
		Write-Warning "An error has occurred when checking your specified download path"
		Write-Error $_
		break
		}
	return $ReturnCode
	}

function DownloadPreReqs() {
	$rc = 0
	$rc = CheckProvidedDownloadPath
	# Download Pre-Reqs
	if($rc -ne -1) {
		$rc = DownLoadPreRequisites
		}
	if($rc -ne -1) {
		Write-Host ""
		Write-Host "Script execution is now complete!"
		Write-Host ""
		}
	}

DownloadPreReqs

SharePoint 2013 : Disable SSL on Central Administration

I’ve been testing the AutoSPinstaller recently and ran into an issue where I’d set the “Use SSL” flag on the Central Admin configuration, but had no certificate/didn’t actually want it to use SSL.

I figured I’d just run Set-SPCentralAdministration -Port <PortNumber> to resolve this issue – however this doesn’t change any of the AAMs, notably the default AAM for Central Admin.

Using the PowerShell script I found in the following blog post, the issue was resolved: http://tom-dw.blogspot.co.uk/2010/06/removing-ssl-from-sharepoint-central.html

Be sure to change the URL and port number to suit your requirements.

#Load the SharePoint assembly
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")

#Get the central admin webapp
$cAdmApp = [Microsoft.SharePoint.Administration.SPAdministrationWebApplication]::Local

#Create a new alternate url
$altUrl = New-Object "Microsoft.SharePoint.Administration.SPAlternateUrl" -ArgumentList "http://sp2013:8010", "Default"

#Set this alternate url as response url
$cAdmApp.AlternateUrls.SetResponseUrl( $altUrl )
$cAdmApp.AlternateUrls.Update()

#Get the alternate urls definition, this should only list our //http://server:10000 url
$cAdmApp.AlternateUrls