B.2 使用工具之前

B.2.1 在 Migrate 伺服器中預先設定 CLI 的值

在開始使用指令行公用程式之前,您需要確定 Migrate 伺服器已正確設定。您可以在 PlateSpin.Migrate.Console.config 檔案 (位於指令行公用程式所在的同一路徑下) 中檢查組態。安裝 Migrate 後,此 .config 檔案中應已填入一些值。

<?xml version="1.0" encoding="utf-8 ?>"
<configuration>
  <appSettings>
    <add key="migrateServerURL" value="http://localhost/PlateSpinMigrate/"/>
    <add key="psuser" value="administrator"/>
    <add key="pspassword" value="encoded_password"/>
    <add key ="encoded" value="yes"/>
  </appSettings>
</configuration>

該工具會在執行指令時使用這些值。您需要根據所要連接之 Migrate 伺服器的設定,調整該檔案中的值。

透過 PlateSpin Migrate 12.0,您現在可以提供已編碼的密碼。若要編碼密碼,請使用 encode 指令。如需有關指令的詳細資訊,請參閱節 B.2.2, 熟悉各項指令。

如果您選擇為工作 .ini 檔案中的來源工作負載和目標容器提供已編碼的密碼,請將 PlateSpin.Migrate.Console.config 檔案的以下行中已編碼的鍵的值設為 yes,否則設為 no。

<add key ="encoded" value="no"/>

B.2.2 熟悉各項指令

您可以在指令提示字元處,使用 Help 選項或 ? 選項來執行該工具,由此顯示該工具支援的指令。例如:

C:\Program Files\PlateSpin Migrate Client\CommandLine>PlateSpin.Migrate.Console.exe Help

該工具會顯示一個矩陣,其中包含類似於下表中所示的資訊:

表 B-1 可從 Migrate CLI 工具使用的指令

指令

描述

run

將設定的 .ini 檔案做為一項已排程的工作執行。當您新增 /wait=no 參數且工作開始執行時,其工作 ID 會顯示在介面中。

query

對工作執行查詢 (指定工作 ID 時) 以顯示其目前狀態。

discover

在準備移轉或「轉換」工作時,執行一項操作來清查某個受支援工作負載或目標電腦的詳細資料。

refresh

重新整理探查到的伺服器。

unDiscover

取消探查伺服器。

prepareForSync

準備伺服器以進行伺服器同步操作。請在執行 ServerSync 工作 (即 ServerSync-xxx.ini) 之前執行此指令 (使用適用的參數)。

imageserver

對伺服器上的工作負載執行影像操作 (即安裝伺服器、解除安裝伺服器、更新工具)。

abort

中止排程的工作。

licenseInfo

顯示 Migrate 伺服器的授權資訊。

serversync

為伺服器進行伺服器同步操作準備,然後使用組態檔案執行 serversync 工作。

encode

編碼文字輸入或文字檔中的資料。

在執行上述任一指令時,您必須在指令行中包含該指令的必要參數,也可以根據需要包含一些選擇性參數。例如,使用 savejob= 參數可將工作保存到預設的位置。

若要在指令提示字元處顯示這些參數的清單,請執行不帶任何參數的指令。例如,如果執行如下所示不帶參數的 discover 指令:

C:\Program Files\PlateSpin Migrate Client\CommandLine>PlateSpin.Migrate.Console.exe discover

指令行介面會顯示以下內容:

[discover]                      discovers a server
Required Parameters:
    /machineAddress=      machine address to discover
    /userName=            the username to use   
    /password=            the password to use        
    /type=                typle like windows, hyper_v, linux,vmware_esx,vmware_vcenter,citrix_xenserver, kvm_server
    Optional Parameters:
    /network=             network name to connect to
    /address=             server address to connect to
    /psuser=              Username used for accessing PlateSpin Migrate server as user different from the one logged on this computer
    /pspassword=          Password used for accessing Platespin Migrate server for the user different from the one logged on this computer
    /wait=                wait for completion of job [yes,no]
    /clusterName=         clustername to be discovered
    /verbose=             verbose mode for output [on,off]
    /output=              the output file
    /format=              the ouptput format to display in [text,html,xml]
    /sslcertificatewarnings=      Whether to Ignore or Enforce SSL Certificate Warnings [Ignore| Enforce]    

附註:您應該熟悉各個 CLI 指令,及其相應的必要參數和選擇性參數。

指令行語法

如果您要執行 discover 指令 (同時也是一個工作),可以在指令提示字元處使用如以下範例所示的語法:

C:\Program Files\PlateSpin Migrate Client\CommandLine>PlateSpin.Migrate.Console.exe discover /machineaddress=10.10.8.100 /username=administrator /password=password /type=windows /wait=no

請注意,此範例包含了所有必要參數和一個選擇性參數。

當 discover 指令 (工作) 啟動時,CLI 工具會顯示其工作 ID,如以下範例所示:

8be8d306-7665-4869-9795-a9dbb3ce1471

您可以利用此 ID 來瞭解工作的狀態,只需使用如下所示的 query 指令即可:

C:\Program Files\PlateSpin Migrate Client\CommandLine>PlateSpin.Migrate.Console.exe query /id=8be8d306-7665-4869-9795-a9dbb3ce1471

該 query 指令會產生一份狀態報告,其中包含工作的所有詳細資料。此類資訊可能與 Migrate 用戶端「工作」檢視窗中顯示的資訊相同。