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

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.
When you run the SFC command together with the /scannow option, some critical changes that were applied during the server installation could revert.
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 {$ -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}
Essentials 2012 SFC / Scannow web.config

Article ID: 2828269 - Last Review: 04/03/2013 17:38:00 - Revision: 6.0

Windows Server 2012 Essentials

  • KB2828269