記錄檔

您可以使用 使用者狀態移轉工具 (USMT) 5.0 記錄檔來監視移轉,以及疑難排解錯誤和失敗的移轉。本主題描述可用於啟用 USMT 記錄檔的命令列選項,以及新的 XML 元素,這些元素可設定哪些類型的錯誤是嚴重錯誤且應該中止移轉,而哪些類型不是嚴重錯誤且應該略過,以便繼續進行移轉。

記錄命令列選項

ScanState 和 LoadState 記錄

進度記錄

清單檔案記錄

診斷記錄

記錄命令列選項

下表描述與記錄相關聯的每個命令列選項,並提供記錄名稱以及每個記錄包含何種資訊的說明。

命令列選項 檔案名稱 說明

/l: [Path\]FileName

Scanstate.log 或 LoadState.log

指定 ScanState.log 或 LoadState log 的路徑和檔案名稱。

/progress: [Path\]FileName

指定進度記錄的路徑和檔案名稱。

依照完成百分比提供移轉狀態的相關資訊。

/v: [VerbosityLevel]

不適用

請參閱 ScanState 語法中的<監視選項>一節。

/listfiles [Path\]FileName

指定清單檔案記錄的路徑和檔案名稱。

提供已移轉的檔案清單。

將環境變數 MIG_ENABLE_DIAG 設為 XML 檔案的路徑。

USMTDiag.xml

診斷記錄包含詳細的系統環境資訊、使用者環境資訊,以及所收集的移轉單元 (migunit) 相關資訊與其內容。

note備註
您不可在 StorePath 中儲存任何記錄檔。如果這麼做,會在 USMT 執行時覆寫記錄檔。

ScanState 和 LoadState 記錄

ScanState 和 LoadState 記錄是您執行 ScanState 和 LoadState 工具時建立的文字檔。您可以使用這些記錄來協助監視移轉。記錄的內容取決於您使用的命令列選項,以及所指定的詳細資訊等級。如需詳細資訊等級的相關資訊,請參閱 ScanState 語法中的<監視選項>。

進度記錄

您可以使用 /progress 選項來建立進度記錄。Microsoft System Center Operations Manager 2007 之類的外部工具可以剖析進度記錄,以更新您的監視系統。每一行的前三個欄位都是固定的,如下所示:

  • 日期: 日期的格式為 dayshortNameOfTheMonthyear。例如:08 Jun 2006。

  • **本地時間:**時間的格式為 hrs:minutes:seconds (使用 24 小時制)。例如:13:49:13。

  • 移轉時間: USMT 的執行持續時間,其格式為 hrs:minutes:seconds。例如:00:00:10。

其餘的欄位是機碼/值組,如下表所示。

機碼

程式

ScanState.exe 或 LoadState.exe。

productVersion

USMT 的完整產品版本號碼。

computerName

USMT 執行所在的來源或目的電腦名稱。

commandLine

用於執行 USMT 的完整命令。

PHASE

報告新的移轉階段正在開始。它可以是下列其中一項:

  • 正在初始

  • 正在掃描

  • 正在收集

  • 正在儲存

  • 正在估計

  • 正在套用

detectedUser

  • 對於 ScanState 工具而言,這些是 USMT 在可以移轉的來源電腦上偵測到的使用者。

  • 對於 ScanState 工具而言,這些是 USMT 在可以移轉的存放區中偵測到的使用者。

includedInMigration

定義使用者設定檔/元件是否要加入移轉中。有效值為 Yes 或 No。

forUser

指定下列其中一項:

  • 正在移轉的使用者狀態。

  • This Computer 表示與使用者沒有關聯的檔案與設定。

detectedComponent

指定 USMT 偵測到的元件。

  • 對於 ScanState 而言,這是已安裝在來源電腦上的元件或應用程式。

  • 對於 LoadState 而言,這是在存放區中偵測到的元件或應用程式。

totalSizeInMBToTransfer

要移轉之檔案與設定的大小總計 (以 MB 為單位)。

totalPercentageCompleted

ScanState 或 LoadState 已完成的移轉百分比總計。

collectingUser

指定 ScanState 正在收集哪位使用者的檔案與設定。

totalMinutesRemaining

完成移轉所需的時間估計值 (以分鐘為單位)。

error

發生的非嚴重錯誤類型。它可以是下列其中一項:

  • UnableToCopy:無法複製到存放區,因為存放區所在的磁碟已滿。

  • UnableToOpen:無法開啟檔案進行移轉,因為其他應用程式或服務已使用非共用模式開啟此檔案。

  • UnableToCopyCatalog:因為存放區毀損而無法複製。

  • UnableToAccessDevice:無法存取裝置。

  • UnableToApply:無法將設定套用到目的電腦。

objectName

導致非嚴重錯誤的檔案或設定名稱。

action

USMT 針對非嚴重錯誤所採取的動作。這些值如下:

  • Ignore:因為已在命令列上指定了 /c 選項,所以會忽略非嚴重錯誤並繼續執行移轉。

  • Abort:因為未指定 /c 選項,因此會停止移轉。

errorCode

errorCode 或傳回值。

numberOfIgnoredErrors

USMT 所忽略的非嚴重錯誤總數。

message

對應於 errorCode 的訊息。

清單檔案記錄

清單檔案記錄 (Listfiles.txt) 會提供已移轉的檔案清單。這份清單可用於疑難排解 XML 問題,或者可以當作已收集到移轉存放區的檔案記錄而保留下來。清單檔案記錄僅可用於 ScanState.exe。

診斷記錄

將環境變數 MIG_ENABLE_DIAG 設為 XML 檔案的路徑,即可取得診斷記錄。

診斷記錄包含:

  • 詳細的系統環境資訊

  • 詳細的使用者環境資訊

  • 正在收集的移轉單元 (migunit) 的相關資訊與其內容

使用診斷記錄

診斷記錄基本上是移轉中所含的所有移轉單元 (migunit) 的報告。移轉單元是由相關聯的元件在 XML 檔案中識別的資料集合。移轉存放區是由移轉中的所有移轉單元所組成。診斷記錄可用於驗證哪些移轉單元已加入移轉中,並可在撰寫移轉 XML 檔案時用於疑難排解。

下列範例描述您可以使用診斷記錄的常見案例。

我已撰寫了「包含」規則,為何這個檔案並未移轉?

假設我們具有下列目錄結構,並且希望 "data" 目錄以及 "New Folder" 中的 "New Text Document.txt" 檔案加入移轉。C:\data 目錄包含:

01/21/2009  10:08 PM    <DIR>          .
01/21/2009  10:08 PM    <DIR>          ..
01/21/2009  10:08 PM    <DIR>          New Folder
01/21/2009  09:19 PM                13 test (1).txt
01/21/2009  09:19 PM                13 test.txt
               2 File(s)             26 bytes

C:\data\New Folder 目錄包含:

01/21/2009  10:08 PM    <DIR>          .
01/21/2009  10:08 PM    <DIR>          ..
01/21/2009  10:08 PM                 0 New Text Document.txt
               1 File(s)              0 bytes

為移轉這些檔案,您撰寫下列移轉 XML:

<?xml version="1.0" encoding="UTF-8"?>
<migration urlid="https://www.microsoft.com/migration/1.0/TestSuite_BUGFIX">

<component context="System"  type="Application">
  <displayName>DATA1</displayName>
  <role role="Data">
    <rules>
      <include>
        <objectSet>
          <pattern type="File">c:\data\ [*]</pattern>
        </objectSet>
      </include>

    </rules>
  </role>
</component>
</migration>

但是在測試移轉時,您發現 "New Text Document.txt" 檔案並未加入移轉中。若要疑難排解此錯誤,可以使用環境變數 MIG_ENABLE_DIAG 集重複進行移轉,以便產生診斷記錄。在搜尋元件 "DATA1" 的診斷記錄時,會發現下列 XML 區段:

<MigUnitList>
<MigUnit Name="&lt;System&gt;\DATA1 (CMXEAgent)" Context="System" ConfidenceLevel="100" Group="Applications" Role="UserData" Agent="CMXEAgent" Selected="true" Supported="true">
<Patterns Type="Include">
<Pattern Type="File" Path="C:\data [*]"/>
</Patterns>
</MigUnit>
</MigUnitList>
<Perform Name="Gather" User="System">
<MigUnit Name="&lt;System&gt;\DATA1 (CMXEAgent)">
<Operation Name="Store" Type="File" Path="C:\data" SimObj="false" Success="true"/>
<Operation Name="Store" Type="File" Path="C:\data [test (1).txt]" SimObj="false" Success="true"/>
<Operation Name="Store" Type="File" Path="C:\data [test.txt]" SimObj="false" Success="true"/>
</MigUnit>
</Perform>

此 XML 區段的分析會顯示在處理移轉規則時建立的移轉單元。<Perform> 區段會詳列已排定要進行收集的實際檔案以及收集作業的結果。 "New Text Document.txt" 檔案沒有出現在這個區段中,這確認了所撰寫的移轉規則並不正確。

XML 元素參考主題的分析會顯示 <pattern> 標記需要進行修改,如下所示:

<pattern type="File">c:\data\* [*]</pattern>

使用已修改的標記再次執行移轉後,診斷記錄會顯示下列內容:

<MigUnitList>
<MigUnit Name="&lt;System&gt;\DATA1 (CMXEAgent)" Context="System" ConfidenceLevel="100" Group="Applications" Role="UserData" Agent="CMXEAgent" Selected="true" Supported="true">
<Patterns Type="Include">
<Pattern Type="File" Path="C:\data\* [*]"/>
</Patterns>
</MigUnit>
</MigUnitList>
<Perform Name="Gather" User="System">
<MigUnit Name="&lt;System&gt;\DATA1 (CMXEAgent)">
<Operation Name="Store" Type="File" Path="C:\data" SimObj="false" Success="true"/>
<Operation Name="Store" Type="File" Path="C:\data [test (1).txt]" SimObj="false" Success="true"/>
<Operation Name="Store" Type="File" Path="C:\data [test.txt]" SimObj="false" Success="true"/>
<Operation Name="Store" Type="File" Path="C:\data\New Folder" SimObj="false" Success="true"/>
<Operation Name="Store" Type="File" Path="C:\data\New Folder [New Text Document.txt]" SimObj="false" Success="true"/>
</MigUnit>
</Perform>

此診斷記錄確認了修改後的 <pattern> 值能夠移轉檔案。

我已撰寫了排除這個檔案的排除規則,為何還會移轉這個檔案?

在此案例中,您具有下列目錄結構,並且想要移轉 "data" 目錄中文字檔以外的所有檔案。C:\Data 資料夾包含:

Directory of C:\Data

01/21/2009  10:08 PM    <DIR>          .
01/21/2009  10:08 PM    <DIR>          ..
01/21/2009  10:08 PM    <DIR>          New Folder
01/21/2009  09:19 PM                13 test (1).txt
01/21/2009  09:19 PM                13 test.txt
               2 File(s)             26 bytes

C:\Data\New Folder 包含:

01/21/2009  10:08 PM    <DIR>          .
01/21/2009  10:08 PM    <DIR>          ..
01/21/2009  10:08 PM                 0 New Text Document.txt
               1 File(s)              0 bytes

您撰寫下列移轉 XML:

<?xml version="1.0" encoding="UTF-8"?>
<migration urlid="https://www.microsoft.com/migration/1.0/TestSuite_BUGFIX">

<component context="System"  type="Application">
  <displayName>DATA1</displayName>
  <role role="Data">
    <rules>
      <include>
        <objectSet>
          <pattern type="File">c:\data\* [*]</pattern>
        </objectSet>
      </include>
    </rules>
    <rules>
      <exclude>
        <objectSet>
          <pattern type="File">c:\* [*.txt]</pattern>
        </objectSet>
      </exclude>

    </rules>
  </role>
</component>

但是在測試移轉時,您發現所有的文字檔仍包含在移轉中。 若要疑難排解這個問題,可以使用環境變數 MIG_ENABLE_DIAG 集執行移轉,以便產生診斷記錄。 在搜尋元件 "DATA1" 的診斷記錄時,會發現下列 XML 區段:

<MigUnitList>
<MigUnit Name="&lt;System&gt;\DATA1 (CMXEAgent)" Context="System" ConfidenceLevel="100" Group="Applications" Role="UserData" Agent="CMXEAgent" Selected="true" Supported="true">
<Patterns Type="Include">
<Pattern Type="File" Path="C:\data\* [*]"/>
</Patterns>
<Patterns Type="Exclude">
<Pattern Type="File" Path="C:\* [*.txt]"/>
</Patterns>
</MigUnit>
</MigUnitList>
<Perform Name="Gather" User="System">
<MigUnit Name="&lt;System&gt;\DATA1 (CMXEAgent)">
<Operation Name="Store" Type="File" Path="C:\data" SimObj="false" Success="true"/>
<Operation Name="Store" Type="File" Path="C:\data [test (1).txt]" SimObj="false" Success="true"/>
<Operation Name="Store" Type="File" Path="C:\data [test.docx]" SimObj="false" Success="true"/>
<Operation Name="Store" Type="File" Path="C:\data [test.txt]" SimObj="false" Success="true"/>
<Operation Name="Store" Type="File" Path="C:\data\New Folder" SimObj="false" Success="true"/>
<Operation Name="Store" Type="File" Path="C:\data\New Folder [New Text Document.txt]" SimObj="false" Success="true"/>
<Operation Name="Store" Type="File" Path="C:\data\New Folder [test.docx]" SimObj="false" Success="true"/>
</MigUnit>
</Perform>

在檢閱診斷記錄時,您確認這些檔案仍在移轉中,而這表示所撰寫的移轉 XML 規則有問題。您撰寫移轉 XML 指令碼的更新,如下所示:

<?xml version="1.0" encoding="UTF-8"?>
<migration urlid="https://www.microsoft.com/migration/1.0/TestSuite_BUGFIX">

<component context="System"  type="Application">
  <displayName>DATA1</displayName>
  <role role="Data">
    <rules>
      <include>
        <objectSet>
          <pattern type="File">c:\data\* [*]</pattern>
        </objectSet>
      </include>
    </rules>
    <rules>
      <exclude>
        <objectSet>
          <pattern type="File">c:\data\* [*.txt]</pattern>
        </objectSet>
      </exclude>

    </rules>
  </role>
</component>


</migration>

修訂後的移轉 XML 指令碼會將檔案從移轉中排除,如診斷記錄中所確認:

<MigUnitList>
<MigUnit Name="&lt;System&gt;\DATA1 (CMXEAgent)" Context="System" ConfidenceLevel="100" Group="Applications" Role="UserData" Agent="CMXEAgent" Selected="true" Supported="true">
<Patterns Type="Include">
<Pattern Type="File" Path="C:\data\* [*]"/>
</Patterns>
<Patterns Type="Exclude">
<Pattern Type="File" Path="C:\data\* [*.txt]"/>
</Patterns>
</MigUnit>
</MigUnitList>
<Perform Name="Gather" User="System">
<MigUnit Name="&lt;System&gt;\DATA1 (CMXEAgent)">
<Operation Name="Store" Type="File" Path="C:\data" SimObj="false" Success="true"/>
<Operation Name="Store" Type="File" Path="C:\data [test.docx]" SimObj="false" Success="true"/>
<Operation Name="Store" Type="File" Path="C:\data\New Folder" SimObj="false" Success="true"/>
<Operation Name="Store" Type="File" Path="C:\data\New Folder [test.docx]" SimObj="false" Success="true"/>
</MigUnit>
</Perform>

另請參閱

其他資源

XML 元素庫
ScanState 語法
LoadState 語法