The below article was first published over The Configuration Manager Support Team Blog site. However we recently discovered that the method described in the article would only work when deploying from an Operating System Install Package (deploying from Windows installation source files). For that reason I recently updated the article to describe what to do when deploying from an Operating System Image.

In addition, there was also a couple of problems with the section where the XML code for the unattend file had to be copied and pasted. The first problem was that the XML code was wrapping in the blog post, which could cause the XML code not to be properly copied and pasted. The second problem was if an existing unattend file was already being used, not all of the lines in the XML code were needed. This made it difficult to figure out what lines in the XML code were needed and where those lines should be copied to. For this reason I changed the instructions to create/edit the unattend file using Windows System Image Manager (WISM) instead. Using WISM ensured that the unattend file would be created/edited correctly.

Please find the updated blog post below.

 

When deploying Windows Server 2008 using a Configuration Manager OSD Task Sequence, additional disks may show as offline when the Task Sequence completes

Symptoms

When using a Configuration Manager 2007 OSD Task Sequence to deploy Windows Server 2008 or Windows Server R2 to a server that contains disks that are not local (such as SAN or SAS disks), when the Task Sequence completes, the additional disks may not come online and may show as offline. Specifically in the Disk Management, the additional disks will show offline with the message:

Disk is offline due to a policy set by an administrator

 

Cause

This issue usually happens with the Enterprise and Datacenter editions of Windows Server 2008 and Windows Server 2008 R2, but may also happen in the Standard edition. In the Enterprise and Datacenter editions of Windows Server 2008 and Windows Server 2008 R2, the default SAN policy is to set the disks to be offline. Please see the following for more information:

You may see "Media is Write Protected" Error or VDS error 80070013 after bringing SAN disk online via Diskpart in Windows Server 2008
http://support.microsoft.com/kb/971436/

VDS_SAN_POLICY Enumeration
http://msdn.microsoft.com/en-us/library/bb525577(VS.85).aspx

Configure the SAN policy
http://technet.microsoft.com/en-us/library/dd799290(WS.10).aspx

SanPolicy
http://technet.microsoft.com/en-us/library/ff715663(WS.10).aspx

 

Resolution

To resolve the issue, for the WinPE phase, the steps from KB971436 need to be added to the Task Sequence. Additionally, for deployments from Operating System Install Packages (Windows source files) the component and setting described in the SanPolicy TechNet article needs to be added to the unattend.xml file. For deployments from Operating System Images, a registry key value will need to be updated with the correct SAN policy value.

 

WinPE

To bring the SAN online and make it read/write while in WinPE:

  1. Open Notepad

  2. In Notepad, paste the following lines:

    select disk <disk#>
    online disk noerr
    attribute disk clear readonly noerr


    Replace <disk#> with the disk number of the SAN/SAS disk (without the brackets <>). The option noerr is used to prevent error messages in cases where the disks may already be online and the read only attribute is already cleared.

  3. Save the Notepad file with the name

    sanpolicy.txt

  4. In the Configuration Manager 2007 Admin Console, under the "Computer Management" --> "Software Distribution" --> "Packages" node, create a package that contains the sanpolicy.txt file created in Steps 2 & 3. A Program does not need to be created for the Package. After creating the Package, make sure to copy the Package to the Distribution Points.

  5. In the Configuration Manager 2007 Admin Console, under the "Computer Management" --> "Operating System Deployment" --> "Task Sequences" node, right click on the affected Task Sequence and choose "Properties".

  6. Immediately after the "Format and Partition Disk" tasks, add a "Run Command Line" task.

  7. In the newly created "Run Command Line" task:

    • Check the "Package:" option, click on the "Browse..." button, and then select the Package created in Step 4.

    • In the "Name:" box, type in:

      Set SAN Policy

    • In the "Command line:" box, enter in

      diskpart /s sanpolicy.txt

  8. Click on the "Apply" button to save the Task Sequence.

 

Full Windows OS - Operating System Install Package

If deploying from an Operating System Install Package (Windows installation source files), to change the default SAN policy for the full Windows OS, a custom unattend.xml file needs to be added to change the setting. If a custom unattend.xml file is already being used, the existing custom unattend.xml file needs to be modified that adds the setting that changes the default SAN policy for the full Windows OS:

  1. In the Configuration Manager 2007 Admin Console, under the "Computer Management" --> "Operating System Deployment" --> "Task Sequences" node, right click on the affected Task Sequence and choose "Properties".

  2. In the "Apply Operating System" task, determine if an existing unattend file is being used by checking to see if the option "Use an unattended or sysprep answer file for a custom installation" is selected. If the option is selected, determine the Package and Filename of the unattend file. Once done click on the "Cancel" button.

  3. Open Windows System Image Manager (WISM) found in the Windows Automated Installation Kit (WAIK). The WAIK is installed by default on any ConfigMgr site server and can be found under the "Microsoft Windows AIK" menu in the Start menu.

  4. Once WISM is open, under the "Windows Image" pane, check to see if there is a Windows image already open. If there is, close it by right clicking on the top node in this pane and choosing "Close Windows Image" .

  5. Under the "Windows Image" pane, right click on "Select a Windows image or catalog file" and choose "Select Windows Image...".

  6. In the "Select a Windows Image" file open box, navigate to the folder location where the Windows installation source files are located. Once in the Windows installation source files folder, navigate into the "sources" folder, select the appropriate .CLG catalog file for the version of Windows that is being installed. and then click on the "Open" button.

  7. Under the "Answer File" pane, check to see if there is an unattend file already open. If there is, close it by right clicking on the top node in this pane and choosing "Close Answer File" .

  8. Under the "Answer File" pane, right click on "Create or open an answer file".

  9. From Step 2, based on if an unattend file was already being used or not:

    • If an an unattend file was not already being used, create a new answer file by choosing the option "New Answer File...".

    • If an unattend file was already being used, choose the option "Open Answer File...", navigate to the answer file package source location as determined by the Package/Filename from Step 2, and then click on the "Open" button.

  10. Under the "Windows Image" pane, expand "Components".

  11. Scroll and locate the component "amd64_Microsoft-Windows-PartitionManager" (x64 OSes) or "x86_Microsoft-Windows-PartitionManager" (x86 OSes), then right click on the component and choose "Add Setting to Pass 2 offlineServicing".

  12. Under the "2 offlineServicing" node in the "Answer File" pane, make sure that "amd64_Microsoft-Windows-PartitionManager" (x64 OSes) or "x86_Microsoft-Windows-PartitionManager" (x86 OSes) is selected.

  13. Under the "Settings" section in the "Microsoft-Windows-PartitionManager Properties" pane, change "SanPolicy" from 2 to 1.

  14. Under the "File" menu, choose "Save Answer File".

    • For existing answer files, the answer file will be automatically saved.

    • For new answer files, a "Save As" dialog box will open prompting for a location to save the answer file. Save the answer file with the name

      unattend.xml

      to a desired location (i.e. a package source folder).

  15. Once the answer file is saved, close WISM.

  16. If a new unattend file was created in Step 9, skip to Step 18.

  17. If an existing unattend file was used in Step 9, in the Configuration Manager Admin console update the Distribution Points for the Package that contains the unattend file from Step 14. Once the Distribution Points are updated, no further steps are needed and the remaining steps can be skipped.

  18. In the Configuration Manager 2007 Admin console, under the "Computer Management" --> "Software Distribution" --> "Packages" node, create a new package that contains the unattend.xml file saved in Step 14. A Program does not need to be created for the Package. After creating the Package, make sure to copy the Package to Distribution Points.

  19. In the Configuration Manager 2007 Admin Console, under the "Computer Management" --> "Operating System Deployment" --> "Task Sequences" node, right click on the affected Task Sequence and choose "Properties".

  20. In the "Apply Operating System" task, check the option "Use an unattended or sysprep answer file for a custom installation". Next to the "Package:" field, click on the "Browse..." button and select the package created in Step 18. Next to the field "Filename:", enter in

    unattend.xml

  21. Click on the "Apply" button to save the Task Sequence.

 

Full Windows OS - Operating System Image

If deploying from an Operating System Image, an unattend file cannot be used to change the default SAN policy for the full Windows OS. When deploying from an image using a Configuration Manager OSD Task Sequence, Windows Setup never runs during the WinPE portion of the deployment. Therefore the settings pass offlineServicing is never processed. Since the Microsoft-Windows-PartitionManager component and the SanPolicy setting can only be added to the offlineServicing settings pass, then a method other than using an unattend file needs to be used. Instead of changing the SanPolicy setting via the unattend file, the equivalent registry key value can be modified once the OS image has been applied. To change the default SAN policy for the full Windows OS when deploying from an image, follow the below steps:

  1. In the Configuration Manager 2007 Admin Console, under the "Computer Management" --> "Operating System Deployment" --> "Task Sequences" node, right click on the affected Task Sequence and choose "Properties".

  2. In the Task Sequence locate and select the "Format and Partition Disk" task that is preparing the drive where the Windows OS is going to be installed.

  3. In the "Format and Partition Disk" task, under the "Volume:" section, double click on the volume where the Windows OS is going to be installed.

  4. In the "Partition Properties" window, if there is not already a variable name next to the field "Variable:", enter in:

    OSDPART

    If there was already a variable name in this field, make a note of it but do not replace it.

  5. In the "Partition Properties" window, click on the "OK" button.

     
  6. In the Task Sequence, locate and select the "Apply Operating System Image" task.

  7. Click the "Add" menu and choose "General" --> "Run Command Line". This should add a "Run Command Line" task immediately after the "Apply Operating System Image" task.

  8. In the newly created "Run Command Line" task:

    • In the "Name:" text box, enter:

      Load System Hive

    • In the "Command line:" text box, enter in the following registry command:

      reg load HKU\temp "%OSPART%\Windows\System32\Config\System"

      If there was already a variable name entered in Step 4, then in the above command line replace "OSPART" with the variable name from Step 4.

  9.  In the Task Sequence, select the newly created "Load System Hive" task.

  10. Click the "Add" menu and choose "General" --> "Run Command Line". This should add a "Run Command Line" task immediately after the "Load System Hive" task.

  11. In the newly created "Run Command Line" task:

    • In the "Name:" text box, enter:

      Change default SAN policy

    • In the "Command line:" text box, enter in the following registry command:

      reg add HKU\temp\ControlSet001\HKLM\System\CurrentControlSet\Services\partmgr\Parameters /v SanPolicy /t REG_DWORD /d 1 /f

  12. In the Task Sequence, select the newly created "Change default SAN policy" task.

  13. Click the "Add" menu and choose "General" --> "Run Command Line". This should add a "Run Command Line" task immediately after the "Change default SAN policy" task.

  14. In the newly created "Run Command Line" task:

    • In the "Name:" text box, enter:

      Unload System Hive

    • In the "Command line:" text box, enter in the following registry command:

      reg unload HKU\temp

  15. Click on the "OK" or "Apply" button to save the Task Sequence.