B.2 使用该工具之前

B.2.1 在 Migrate Server 中预先配置 CLI 的值

在使用命令行实用程序之前,需确保 Migrate Server 已正确配置。您可以在 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 Server 的设置,调整该文件中的值。

现在,您可以通过 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

显示迁移服务器的许可证信息。

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 客户端的“作业”视图中看到的信息类型相同。