Migrate for Compute Engine 4.9 版的使用期限已结束,不再受支持。查看最新文档或选择其他可用版本。

安装 PowerShell 模块

利用 Migrate for Compute Engine,您可以使用自定义模块中的命令通过 PowerShell 编写操作的脚本。本文档介绍如何在 PowerShell 模块中安装和使用内置帮助。

模块安装

  1. “下载”页面下载 Migrate for Compute Engine PowerShell 模块安装程序,或打开 Migrate for Compute Engine Manager 并点击首页上的 PowerShell 模块下载图标。
  2. 运行安装文件并按照向导的说明操作。您必须接受 Velostrata 最终用户服务协议并选择安装位置。

  3. 将安装以下 PowerShell 模块:

    • Velostrata.PowerShell
    • Velostrata.Runbook
  4. 您现在可以通过以下方式连接到 Migrate for Compute Engine Manager:

PS C:\Users\Demo> Import-Module Velostrata.PowerShell
PS C:\Users\Demo> Connect-VelostrataManager

脚本会提示您输入 Migrate for Compute Engine Manager 的 IP 地址。如果提示您输入用户名,请使用 apiuser密码是您在创建 Migrate for Compute Engine Manager 时设置的密码。

从 PowerShell 获取帮助

PowerShell 模块通过 Get-Help 命令提供帮助。

PS C:\Users\Demo> Get-help Connect-VelostrataManager

NAME
    Connect-VelostrataManager

SYNOPSIS
    This cmdlet establishes a connection to a Velostrata Manager Server
system.

    Connect-VelostrataManager [-Server] <String> [-Username] <String>
[-Password] <SecureString> [-Port [<Int32>]]

SYNTAX
    Connect-VelostrataManager [-Server] <String> [-Port <Int32>] [-Username]
<String> [-Password] <SecureString>  [<CommonParameters>]

DESCRIPTION
    The cmdlet starts a new session or re-establishes a previous session with
Velostrata Manager Server using the specified parameters.
    When you attempt to connect to a server, the server checks for valid
credentials and then sets the relevant PSVariables.
    Once the user is authenticated successfully, the session remains in effect
until the PowerShell session is closed or a new Migrate for Compute Engine Manager session is established.
    Note: You can have only one active connection to a Migrate for Compute Engine Manager server
per PowerShell local session.

REMARKS
    To see the examples, type: "get-help Connect-VelostrataManager -examples".
    For more information, type: "get-help Connect-VelostrataManager -detailed".
    For technical information, type: "get-help Connect-VelostrataManager -full".
    For online help, type: "get-help Connect-VelostrataManager -online"