Troubleshooting Windows Update Agent

A short guide for troubleshooting Windows Update Agent:

1. Download and execute//install “System Update Readiness Tool (CheckSur)” from https://support.microsoft.com/en-us/kb/947821.
Check the following log for errors C:\Windows\Logs\CBS\CheckSUR.log
2. For any updates that could not be repaired by CheckSur, download the msu-package manually from Microsoft Catalog, http://catalog.update.microsoft.com/v7/site/Home.aspx or from Microsoft Download Center, http://www.microsoft.com/download
3. Create the folder C:\Windows\CheckSur\packages if it doesnt already exists and move the downloaded updates there.
4. Execute “System Update Readiness Tool (CheckSur)” again.
5. Install updates from Windows Update.

Remove the BDEDrive partition

MDT creates a partition named BDEDrive when it installs Windows OS. This drive is used with Bitlocker to boot the OS. If Bitlocker never will be used the BDEDrive can be removed using the following procedure:

1. Start an elevated command promt and execute the following command to copy startup files to the C-drive:
bcdboot C:\Windows /s C:
2. Set partition C:\ as active:
diskpart
list disk
select disk 0
list part
select part 1
active part
3. Reboot the computer:
shutdown -r -t 0
4. Delete the BCD Drive:
diskpart
list disk
select disk 0
list part
select part 2
delete part

There is a more indepth explanation at the following site:
http://aikitsupport.com/bde-drive-removal/

Features On Demand

How To Patch Windows Image to be able to install Features On Demand on patched Windows Server 2012:
0. Show applied patches:
WMIC QFE > PATCHES.TXT
NOTEPAD PATCHES.TXT
1. Download patches using “WSUS Offline Update”
C:\wsusoffline\UpdateGenerator.exe
2. Mount the wim-file using dism:
dism /mount-wim /WimFile:C:\wsusoffline\wim\install.wim /index:2 /mountDir:C:\wsusoffline\dismmount
3. Apply patches
dism “/Image:c:\wsusoffline\dismmount” /Add-Package “/PackagePath:C:\wsusoffline\client\w62-x64\temp”
4. Commit changes
dism /Unmount-Wim /MountDir:c:\wsusoffline\dismmount /commit
5. Repeat step 2-4 for the other images (index 1,3,4)

References:
http://www.virtualizationadmin.com/kbase/VirtualizationTips/GeneralVirtualizationTips/ServerVirtualizationTips/ManagementAdministration/CheckinginstalledupdatesonServerCore.html
http://www.sysadminlab.net/mobile/creating-a-fully-patch-install-wim-for-windows-78-without-mdt-but-using-wsus-offline-updater
http://blogs.technet.com/b/joscon/archive/2013/06/24/3532554.aspx#pi47623=2
https://technet.microsoft.com/en-us/magazine/hh825626.aspx

To list packages added to the image:
dism /Image:C:\wsusoffline\dismmount /Get-Packages

For troubleshooting installations:
C:\Windows\Logs\CBS\CBS.LOG

PowerShell Remoting

First of all Powershell Remoting must be enabled on the machine you are going to manage. The command ‘Enable-PSRemoting -Force’ starts the WinRM service, changes its startup mode to automatic and creates a firewall-rule that allows incoming connections.

You can test the connection by entering the following Powershell command from an remote computer:
Test-WsMan

The result should look something like in the following example:
PS C:\Users\TestUser> Test-WsMan TESTCOMPUTER

wsmid : http://schemas.dmtf.org/wbem/wsman/identity/1/wsmanidentity.xsd
ProtocolVersion : http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd
ProductVendor : Microsoft Corporation
ProductVersion : OS: 0.0.0 SP: 0.0 Stack: 3.0

To create a remote session, enter the following command:
Enter-PSSession -Computername -Credential <domain\username>

References:
https://technet.microsoft.com/en-us/library/hh849694(v=wps.620).aspx
https://technet.microsoft.com/en-us/library/hh849873(v=wps.620).aspx
https://technet.microsoft.com/en-us/library/hh849707(v=wps.620).aspx

Initialize, partition and format disks using PowerShell

I ran into this good blogpost about using PowerShell to Initialize Raw Disks, and to Partition and Format Volumes.
http://blogs.technet.com/b/heyscriptingguy/archive/2013/05/29/use-powershell-to-initialize-raw-disks-and-partition-and-format-volumes.aspx

To summarize, you can initialize raw disks and partition and format volumes using the following simple PowerShell “script”:
Get-Disk | Where partitionstyle -eq ‘raw’ | Initialize-Disk -PartitionStyle MBR -PassThru | New-Partition -AssignDriveLetter -UseMaximumSize | Format-Volume -FileSystem NTFS -NewFileSystemLabel “disk2” -Confirm:$false