Microsoft KB Archive/946139

= You cannot resolve the built-in IIS accounts after you set a Windows Server 2008-based server that is running IIS 7.0 as a domain controller =

Article ID: 946139

Article Last Modified on 12/31/2007

-

APPLIES TO


 * Microsoft Internet Information Services 7.0

-



SYMPTOMS
Consider the following scenario. You have a Windows Server 2008-based server that is running Internet Information Services (IIS) 7.0. You set the Windows Server 2008-based server as a domain controller of a Windows 2000-based domain or of a Windows Server 2003-based domain. In this scenario, you cannot resolve the built-in IIS accounts, such as the IIS_IUSRS group or the IUSR guest user account. You can only see the raw security identifier (SID) of the built-in IIS accounts.

Note This problem does not occur if you set the Windows Server 2008-based server as a domain controller of a Windows Server 2008-based domain.



CAUSE
This problem occurs because the IIS 7.0 built-in accounts specification for Windows Server 2008 does not exist in earlier domains, such as Windows 2000-based domains and Windows Server 2003-based domains. When the IIS 7.0 server is set as a Windows 2000-based domain controller or a Windows Server 2003-based domain controller, the Windows Server 2008 accounts cannot be resolved.



RESOLUTION
To resolve this problem, use the following sample script.

Note You must restart the server after you run this script. /*  SamUpgradeTask.js   (c) 2007, Microsoft Corp. // Check the version of the operating system. Stop the script if the version is earlier than 6. if ( ! CheckOSVersion ) {   WScript.Echo(&quot;ERROR: This script will only work on Longhorn Server or above.&quot;); WScript.Quit(1); } // Retrieve the local computer's rootDSE LDAP object. var localRootDse = null; try {   localRootDse = GetObject(&quot;LDAP://localhost/rootDSE&quot;); } catch(e) {   WScript.Echo(&quot;There was an error attempting to retrieve the localhost RootDSE object.&quot;); WScript.Echo(&quot;Perhaps this machine is not a Domain Controller on the network?&quot;); WScript.Echo(&quot;ErrorCode: &quot; + e.number); WScript.Quit(1); } // Retrieve several rootDSE properties var dnsHostName = localRootDse.Get(&quot;dnsHostName&quot;); var dsServiceName = localRootDse.Get(&quot;dsServiceName&quot;); var defaultNamingContext = localRootDse.Get(&quot;defaultNamingContext&quot;); // Open the default naming context var ncObj = GetObject(&quot;LDAP://&quot; + defaultNamingContext); // Get the &quot;FSMO Role Owner&quot; var strfsmoNtdsa = ncObj.FsmoRoleOwner; var fsmoNtdsaObj = GetObject(&quot;LDAP://&quot; + strfsmoNtdsa); // Get the parent object of &quot;FSMO Role Owner&quot; var fsmoServerObj = GetObject(fsmoNtdsaObj.Parent); // By using the Server Reference, retrieve the name of the PDC computer var strFsmoComputer = fsmoServerObj.ServerReference; var fsmoComputerObj = GetObject(&quot;LDAP://&quot; + strFsmoComputer); var pdcName = fsmoComputerObj.Get(&quot;name&quot;); // Get the RootDSE object for the PDC var pdcRootDse = GetObject(&quot;LDAP://&quot; + pdcName + &quot;/rootDSE&quot;); // Check whether the PDC is a legacy domain or not. var domainControllerFunctionality = pdcRootDse.Get(&quot;domainControllerFunctionality&quot;); if ( domainControllerFunctionality > 2 ) {   WScript.Echo(&quot;Domain is already operating in a mode higher than Windows Server 2003 mode. Stopping script execution.&quot;); WScript.Quit(0); } // Get the default naming context for the PDC var pdcDefaultNamingContext = pdcRootDse.Get(&quot;defaultNamingContext&quot;); // Retrieve the well known object from the PDC var pdcSystem = GetObject(&quot;LDAP://&quot; + pdcName + &quot;/&quot;); // Get the distinguished name for the well known object var pdcDistinguishedName = pdcSystem.Get(&quot;distinguishedName&quot;); // Check whether the task has already been run var taskMarker = null; try {   taskMarker = GetObject(&quot;LDAP://&quot; + pdcName + &quot;/&quot;); } catch(e) {   if ( e.number == -2147016656 ) // Check and see if error code is ERROR_DS_NO_SUCH_OBJECT {       taskMarker = null; }   else {       WScript.Echo(&quot;Error attempting to retrieve well known object from PDC.&quot;); WScript.Echo(&quot;Name: &quot; + e.name + &quot;\nDescription: &quot; + e.description + &quot;\nCode: &quot; + e.number + &quot;\nMessage: &quot; + e.message); WScript.Quit(1); } } // If the well known object exists, the SAM upgrade is already running. Therefore, stop the script. if ( taskMarker != null ) {   WScript.Echo(&quot;SAM upgrade task already being run. No work done.&quot;); WScript.Quit(1); } // Get the Server container with that distinguished name var serverObj = GetObject(&quot;LDAP://&quot; + pdcName + &quot;/CN=Server,&quot; + pdcDistinguishedName); // Prepare a safe array (for example, VBArray) with one entry var jsArray = new Array(1); jsArray[0] = &quot;B:32:6ACDD74F3F314ae396F62BBE6B2DB961:&quot;+ dsServiceName; var vbArray = JS2VBArray(jsArray); try {   // Append an entry to the &quot;Other-Well-Known-Objects&quot; attribute for the // previous server object. serverObj.PutEx(3, &quot;otherWellKnownObjects&quot;, vbArray); serverObj.SetInfo; } catch(e) {   WScript.Echo(&quot;Unexpected error attempting to put the well known GUID.&quot;); WScript.Echo(&quot;ErrorCode: &quot; + e.number); } WScript.Echo(&quot;Running upgrade task.&quot;); // Set the &quot;runSamUpgradeTasks&quot; attribute in the local rootDSE localRootDse.Put(&quot;runSamUpgradeTasks&quot;, 1); localRootDse.SetInfo; // Remote the binary data from the previous well known object entry serverObj.PutEx(4, &quot;otherWellKnownObjects&quot;, vbArray); serverObj.SetInfo; // The upgrade is complete. WScript.Echo(&quot;Done!&quot;); function CheckOSVersion {   var wbemFlagReturnImmediately = 0x10; var wbemFlagForwardOnly = 0x20; var objWMIService = GetObject(&quot;winmgmts:\\\\.\\root\\CIMV2&quot;); var colItems = objWMIService.ExecQuery(&quot;SELECT * FROM Win32_OperatingSystem&quot;, &quot;WQL&quot;,                                     wbemFlagReturnImmediately | wbemFlagForwardOnly); var enumItems = new Enumerator(colItems); for (!enumItems.atEnd; enumItems.moveNext) { var objItem = enumItems.item; var fullVersion = objItem.Version; var indexPoint = fullVersion.indexOf(&quot;.&quot;); if ( indexPoint == -1 ) {           return false; }       var majorVersion = fullVersion.substring(0, indexPoint); return (majorVersion >= &quot;6&quot;); }   return false; } function JS2VBArray( objJSArray ) {   var dictionary = new ActiveXObject( &quot;Scripting.Dictionary&quot; ); for ( var i = 0; i < objJSArray.length; i++ ) {       dictionary.add( i, objJSArray[ i ] ); }   return dictionary.Items; }



STATUS
This behavior is by design.

Keywords: kbtshoot kbexpertiseinter kbprb KB946139

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.