Category Archives: Microsoft

Microsoft related posts.

Error 14098 the Component Store has been corrupted

When the OS is serviced, the component store is updated. It is part of Windows Imaging and Servicing stack. If you got the error 14098 ‘The component store has been corrupted’, it means that something went wrong with Windows updates and its packages.

To fix the component store, you can use DISM – Deployment Image Servicing and Management tool.

/RestoreHealth: This checks for component store corruption, records the corruption to C:\Windows\Logs\CBS\CBS.log and fixes the corruption using Windows Update or using your Windows installation source.

Dism /Online /Cleanup-Image /RestoreHealth

Clean up the WinSxS folder on Windows 2012 R2

Use the /AnalyzeComponentStore to analyze the size of the Component Store (WinSxS folder) in Windows. The AnalyzeComponentStore option is available in Windows 8.1 Windows Server 2012 R2.

dism.exe /online /Cleanup-Image /AnalyzeComponentStore

Dism.exe removes superseded and unused system files from a system with the /StartComponentCleanup parameter.

dism.exe /online /Cleanup-Image /StartComponentCleanup

Using the /ResetBase switch with the /StartComponentCleanup parameter of dism.exe, all superseded versions of every component in the component store is removed.  All existing service packs and updates cannot be uninstalled after this command is completed. This will not block the uninstallation of future service packs or updates.

dism.exe /online /Cleanup-Image /StartComponentCleanup /ResetBase

The /SPSuperseded parameter removes any backup components needed for de-installation of a service pack. The service pack cannot be uninstalled after this command is completed.

dism.exe /online /Cleanup-Image /SPSuperseded


Can’t Install Roles or Features on Windows 2012 R2

I came across a really strange issue.  When going through the Add Roles and Features Wizard, I tried to click next to the Server Roles page.  The wizard then shows a red bar with the following error, “The request to list features available on the specified server failed.”

Doing an SFC /SCANNOW like so many internet searches says to do, does not clear the issue.  The reason seems that the server was in a pending reboot state for changes to be made.  Rebooting never makes any changes.  This state also prevents using DISM from fixing any corruption.

It turns out that one can boot into the repair console to get to files offline.  Navigate to the C:\Windows\WinSxS directory and rename the pending.xml file to something like pending.xml.old.  This tricks Windows into thinking that nothing else is pending a reboot and allows one to use SFC and DISM to clean up system files.

It looks like a ton of Windows updates went in, but didn’t get installed correctly.  Checking for Windows updates produced over 77 important updates as opposed to the 3 that were being presented before renaming pending.xml.

SFC and DISM fixes went in, a couple of reboots and I am now able to properly install roles and features.

Get the Microsoft SQL version query

     WHEN CONVERT(VARCHAR(128), SERVERPROPERTY ('productversion')) like '8%' THEN 'SQL2000'
     WHEN CONVERT(VARCHAR(128), SERVERPROPERTY ('productversion')) like '9%' THEN 'SQL2005'
     WHEN CONVERT(VARCHAR(128), SERVERPROPERTY ('productversion')) like '10.0%' THEN 'SQL2008'
     WHEN CONVERT(VARCHAR(128), SERVERPROPERTY ('productversion')) like '10.5%' THEN 'SQL2008 R2'
     WHEN CONVERT(VARCHAR(128), SERVERPROPERTY ('productversion')) like '11%' THEN 'SQL2012'
     WHEN CONVERT(VARCHAR(128), SERVERPROPERTY ('productversion')) like '12%' THEN 'SQL2014'
     WHEN CONVERT(VARCHAR(128), SERVERPROPERTY ('productversion')) like '13%' THEN 'SQL2016'     
     ELSE 'unknown'
  END AS MajorVersion,
  SERVERPROPERTY('ProductLevel') AS ProductLevel,
  SERVERPROPERTY('Edition') AS Edition,
  SERVERPROPERTY('ProductVersion') AS ProductVersion

SimpleSAMLphp setup on Windows 2008 – Install PHP

The application runs on PHP, so it will need to be installed on the server for Windows to run the scripts.
You should be able to go here for the latest PHP installer for IIS:
Use the Web Platform Installer to automate the installation and configuration of PHP on your server.  You could do it manually, but it’s a pain.  The installer should be able to be found here;
Version 5.6.0 was used at the time of this writing.
Find the version of PHP you want to install and click the Add button.  Example: PHP 5.6.0.
If dependent components are missing, they will be listed to be included with the PHP installation.  Go ahead and click the “I Accept” button.
After the installation completes, you’ll be presented with a summary page of the pieces that were installed.  Click on Finish.
Use PHP Manager in IIS Manager to finish configuring PHP:
Set recommendations for adding index.php to default file and automatically reset php when config.php is updated.  Click on the “View recommendations.” link.
Click on the “Enable or disable and extension” link.
Use “Enable or disable and extension” to drill down and enable LDAP Extension:
LDAP will be the protocol used by SimpleSAMLphp to get user information from Active Directory when authenticating.
Next we will look at installing the SimpleSAMLphp application.

Get Hyper-V Guest Properties

$vm = "<enter the friendly name of a virtual machine>";

filter Import-CimXml
    $CimXml = [Xml]$_
    $CimObj = New-Object -TypeName System.Object
    foreach ($CimProperty in $CimXml.SelectNodes("/INSTANCE/PROPERTY"))
 if ($CimProperty.Name -eq "Name" -or $CimProperty.Name -eq "Data")
         $CimObj | Add-Member -MemberType NoteProperty -Name $CimProperty.NAME -Value $CimProperty.VALUE

$VmObj = Get-WmiObject -Namespace root\virtualization -Query "Select * From Msvm_ComputerSystem Where ElementName='$vm'"
$KvpObj = Get-WmiObject -Namespace root\virtualization -Query "Associators of {$VmObj} Where AssocClass=Msvm_SystemDevice ResultClass=Msvm_KvpExchangeComponent"
$KvpObj.GuestIntrinsicExchangeItems | Import-CimXml

Reposted from here.

Optimizing SQL

Creating a maintenance plan in SQL Server 2005 or 2008 to optimize database performance

Article: HOWTO8589

How can I create a maintenance plan in SQL Server 2005 or 2008 to optimize database performance?
A SQL maintenance plan for rebuilding indexes and setting the index free space percentage to 10% within the Symantec/Altiris databases should be scheduled to run at least monthly (preferably weekly). This maintenance plan should also be configured to update column statistics (index statistics are updated during the index rebuild process). It is recommended that this plan be scheduled to run at a time when database utilization by the Symantec applications is at its lowest. This could be on a Sunday during the day or a during a scheduled maintenance cycle, etc.

To build the SQL Maintenance plan for SQL 2005/2008:

  1. Make sure that the SQL Server Agent service is running.
  2. Open SQL Server Management Studio.
  3. Expand the Management folder.
  4. Right-click on Maintenance Plans and select Maintenance Plan Wizard.
  5. When the SQL Server Maintenance Plan Wizard info page opens up; click Next.
  6. Give the maintenance plan a name such as “Rebuild Indexes for Altiris Databases”.
  7. Leave the default option set to Single schedule for the entire plan… Click the Change button to put in the schedule for this plan.
  8. Enter in the chosen weekly time.
  9. Click OK.
  10. Click Next.
  11. Check the options to Rebuild Indexes and Update Statistics.
  12. Click Next.
  13. Make sure that “Rebuild Index” task is at the top.
  14. Click Next.
  15. Click the Database drop-down.
  16. In the These databases section, select all the databases you are trying to optimize, such as Altiris, Altiris_Incidents, eXpress, AeXRSdatabase, Symantec_CMDB and Symantec_CMDB_IntelAMT.
  17. Click OK.
  18. Select Change free space per page percentage to and set its value to 10% (20% if only rebuilding indexes monthly).
    • “Sort results in tempdb” should generally not be used; however, if SQL memory resources are low, then this will help, but it does cause rebuilding to take a lot longer.
    • Make sure that Keep index online while reindexing is unchecked.  Altiris databases uses ntext fields which prevent clustered indexes from being rebuilt while online for those tables that have an ntext column.
  19. Click Next.
  20. Chose the same databases as before.
  21. In the Update section, select Column Statistics Only.
  22. In the Scan Type section, select Full scan Click Next.
  23. Check the option to Write a report to a text file and allow it to write to the default location.
  24. Click Next.
  25. Click Finish.

Once the wizard is finished with creation, you can click Close. To execute the maintenance plan, right-click it in the left hand Object Browser pane and click Execute.

Additional Performance Considerations:

  • Make certain that the database files are not physically fragmented. Periodically check the fragmentation level on the volume where the database files are hosted and defragment when needed.
  • See KB49632: Optimizing SQL Server 2005 on Windows Server 2003 for more optimization information.

Article URL