The web configuration file may become corrupted when you run the SFC command in Windows Server 2012 Essentials

Symptoms

When you run the SFC (system file checker) command together with the /scannow option in Windows Server 2012 Essentials, the Remote Web Access feature may break. 

Additionally, the web configuration file may become corrupted. Specifically, the string "%SBSPRODUCTBINPLACEHOLDER%" is displayed in the Web.config file in the following folder:
X:\Program Files\Windows Server\Bin\WebApps\Site

Note In this folder name, the placeholder X represents the label for the system volume.

Cause

When you run the SFC command together with the /scannow option, some critical changes that were applied during the server installation could revert.

Resolution

To resolve this issue, run the following Windows PowerShell commands as an administrator. Run each command separately and in the following order:

  1. $BinDir = [System.Environment]::ExpandEnvironmentVariables("%programfiles%\windows server\bin") 
  2. $WebDir = [System.Environment]::ExpandEnvironmentVariables("%programfiles%\windows server\bin\WebApps") 
  3. $WebDir = get-childitem $WebDir –recurse 
  4. $List = $WebDir | where {$_.name -eq "web.config"} 
  5. foreach($listItem in $List){ if($listItem.DirectoryName -match "MacWebService") {continue;} ($a= Get-Content $listItem.FullName); $a = $a -replace "%SBSPRODUCTBINPLACEHOLDER%", $BinDir; remove-item $listItem.FullName; $f = [io.path]::Combine($listItem.DirectoryName, "Web.config"); $a >> $f} 
Properties

Article ID: 2828269 - Last Review: Apr 3, 2013 - Revision: 1

Windows Server 2012 Essentials

Feedback