> ## Documentation Index
> Fetch the complete documentation index at: https://help.gorelo.io/llms.txt
> Use this file to discover all available pages before exploring further.

# 与现有远程访问工具集成

> 通过配置自定义资产字段和 URL 启动快捷方式，将 Splashtop、AnyDesk、TeamViewer、RustDesk 等远程访问工具与 Gorelo 集成。

按照本指南将 Splashtop、AnyDesk、TeamViewer 等其他工具集成到 Gorelo 中。

你可以将 Gorelo 与任何支持通过 URL 启动的远程访问工具集成，例如 Splashtop、AnyDesk 或 TeamViewer。

此示例使用：

* Splashtop Business
* RustDesk
* Webroot

<Tabs>
  <Tab title="Splashtop">
    <Steps>
      <Step title="创建自定义资产字段。">
        1. 导航到 **Settings** > **Assets** > **[Custom Fields](https://app.gorelo.io/Admin/admin-settings#asset#assetcustomfields)。**
        2. 添加自定义字段，详细信息如下：
           * **Name**：`Splashtop SUUID`
           * **Variable**：`splashtopSUUID`

        <Frame>
          <img src="https://mintcdn.com/gorelo/VNk9kGyLTQMfiA_W/images/image-93.png?fit=max&auto=format&n=VNk9kGyLTQMfiA_W&q=85&s=fa3d59e87f10da576bb7b5435b89496c" alt="Image" width="784" height="606" data-path="images/image-93.png" />
        </Frame>
      </Step>

      <Step title="编写脚本。">
        1. 导航到 **[Scripts](https://app.gorelo.io/Asset/script-list)。**
        2. 创建一个脚本，详细信息如下：
           * **Name**：`Store-SplashtopSUUID`
           * **Content**：

        ```powershell theme={null}
        # Define registry path for 64-bit machines
        $regPath64 = "HKLM:\SOFTWARE\WOW6432Node\Splashtop Inc.\Splashtop Remote Server"

        # Define the value name for the SUUID
        $regValue = "SUUID"

        # Try to retrieve the SUUID from the 64-bit registry
        if (Test-Path $regPath64) {
            try {
                $suuid = Get-ItemProperty -Path $regPath64 -Name $regValue -ErrorAction Stop
                
                # Check if the SUUID value is present
                if ($suuid.$regValue) {
                    $suuidValue = $suuid.$regValue
                    Write-Output "Splashtop SUUID: $suuidValue"
                    
                    # Write the SUUID to the Gorelo custom field
                    GoreloAction -SetCustomField -Name 'asset.splashtopSUUID' -Value $suuidValue
                } else {
                    Write-Output "SUUID not found in the registry."
                }
            } catch {
                Write-Output "Error retrieving SUUID from the registry: $_"
            }
        } else {
            Write-Output "Splashtop registry not found."
        }
        ```
      </Step>

      <Step title="通过策略部署脚本。">
        1. 导航到 **[Policies](https://app.gorelo.io/Asset/policy-management)。**
        2. 编辑覆盖你想要存储 Splashtop SUUID 的资产的现有策略。
        3. 添加 `Store-SplashtopSUUID` 脚本并设置为每天在你偏好的时间重复运行。
        4. **保存**并**分发**策略。
      </Step>

      <Step title="创建快捷方式。">
        1. 导航到 **[Asset Shortcuts](https://app.gorelo.io/Admin/admin-settings#asset#assetshortcuts)。**
        2. 添加一个新快捷方式，详细信息如下：
           * **Name**：`Splashtop`
           * **URL**：`t-business://com.splashtop.business?account=&uuid={{$gorelo:asset.splashtopSUUID}}&sessiontype=remote`
           * **Pinned Name**：`Splashtop`
                     <Frame>
                       <img src="https://mintcdn.com/gorelo/VNk9kGyLTQMfiA_W/images/image-94.png?fit=max&auto=format&n=VNk9kGyLTQMfiA_W&q=85&s=6f6a457fb40ae89f476e82e9493affdb" alt="Image 94" width="776" height="756" data-path="images/image-94.png" />
                     </Frame>
             你现在应该会在资产详情页右上角看到 **SPLASHTOP** 快捷方式。如果脚本成功填充了 `$gorelo:asset.splashtopSUUID` 变量，那么此快捷方式将启动 Splashtop Business 应用程序。
                     <Frame>
                       <img src="https://mintcdn.com/gorelo/VNk9kGyLTQMfiA_W/images/image-95.png?fit=max&auto=format&n=VNk9kGyLTQMfiA_W&q=85&s=c904bd21d026b986eb127ecb9c8d72d0" alt="Image" width="310" height="211" data-path="images/image-95.png" />
                     </Frame>
      </Step>
    </Steps>

    该快捷方式不会安装 Splashtop——需要使用另一个脚本来执行此操作，例如：

    ```powershell theme={null}
    # Installs Splashtop Streamer using the installer MSI uploaded to $gorelo:file.splashtopInstaller
    # Runs a silent install using the 12-digit deployment key at $gorelo:client.splashtopKey

    #Check for presence of SplashtopKey
    if ([string]::IsNullOrEmpty($gorelo:client.splashtopKey)) {
    Write-Output "No SplashTop Key stored for this client. Automatic installation cancelled."
    GoreloAction -Alert -Severity 3 -Name "No Splashtop Key stored for this client" -Description "No Splashtop Key is stored in the client custom field so the automatic installation has been cancelled" -Suppress 0
    } else {
    Write-Output "Splashtop Key Found: " $gorelo:client.splashtopKey
    Write-Output "Installer Path: " $gorelo:file.splashtopInstaller
    }

    #Install Splashtop
    msiexec /i $gorelo:file.splashtopInstaller USERINFO="dcode=$gorelo:client.splashtopKey,hidewindow=1,confirm_d=0" /qn /norestart
    ```
  </Tab>

  <Tab title="RustDesk">
    强烈建议托管你自己的 RustDesk 服务器，并修改初始安装脚本以支持这一点。

    <Steps>
      <Step title="创建自定义资产字段。">
        1. 导航到 **Settings** > **Assets** > **[Custom Fields](https://app.gorelo.io/Admin/admin-settings#asset#assetcustomfields)。**
        2. 添加自定义字段，详细信息如下：
           * **Name**：RustDesk ID
           * **Variable**：rustdeskID
                     <Frame>
                       <img src="https://mintcdn.com/gorelo/U5LP8ONeOiG8YFD5/images/image-99.png?fit=max&auto=format&n=U5LP8ONeOiG8YFD5&q=85&s=269f2deb3032c4d2820a8a5c961a4e1a" alt="Image" width="803" height="622" data-path="images/image-99.png" />
                     </Frame>
        3. 添加自定义字段，详细信息如下：
           * **Name**：RustDesk Password
           * **Variable**：rustdeskPassword
                     <Frame>
                       <img src="https://mintcdn.com/gorelo/lqwr7vR8TnJnU6L2/images/image-100.png?fit=max&auto=format&n=lqwr7vR8TnJnU6L2&q=85&s=bbc282d1359062edafaed06e986119bd" alt="Image" width="802" height="618" data-path="images/image-100.png" />
                     </Frame>
      </Step>

      <Step title="上传安装程序文件。">
        1. 导航到 **Settings** > Asset > [**<u>Files</u>**](https://app.gorelo.io/Admin/admin-settings#asset#filerepository)
        2. 添加一个文件，详细信息如下：
           * **File**：上传最新的 RustDesk MSI 安装程序
           * **Variable**：rustdesk
      </Step>

      <Step title="编写脚本。">
        1. 导航到 [**Scripts**](https://app.gorelo.io/Asset/script-list)
        2. 创建一个脚本，详细信息如下：
           * **Name**：Install Rustdesk
           * **Content**：

        ```powershell theme={null}
           #Install Rusdesk
           msiexec /i $gorelo:file.rustdesk /qn /norestart CREATESTARTMENUSHORTCUTS="N" CREATEDESKTOPSHORTCUTS="N" /l*v install.log

        ```

        3. 创建一个脚本，详细信息如下：
           * Name：Write Rustdesk ID and Password
           * Content：

        ```powershell theme={null}
           $RustDeskPath = "$env:ProgramFiles\RustDesk\RustDesk.exe"
           
           # Get Rustdesk ID using the executable
           $RustdeskID = cmd /c "`"$RustDeskPath`" --get-id"
           
           if ($RustdeskID) {
              # Write ID to Gorelo custom field
              GoreloAction -SetCustomField -Name 'asset.rustdeskID' -Value $RustdeskID
              Write-Output "Rustdesk ID: $RustdeskID written to Gorelo"
           
              # Generate random 16 character password
              $Password = -join ((65..90) + (97..122) + (48..57) | Get-Random -Count 16 | ForEach-Object {[char]$_})
              
              # Set the password in Rustdesk
              cmd /c "`"$RustDeskPath`" --password $Password"
              
              # Write password to Gorelo custom field
              GoreloAction -SetCustomField -Name 'asset.rustdeskPassword' -Value $Password
              Write-Output "Rustdesk password set and saved to Gorelo"
              exit 0
           } else {
              Write-Output "Failed to get Rustdesk ID"
              exit 1
           }
        ```
      </Step>

      <Step title="通过策略部署脚本。">
        1. 导航到 **[Policies](https://app.gorelo.io/Asset/policy-management)。**
        2. 编辑覆盖你想要通过 RustDesk 安装和连接的资产的现有策略。
        3. 为 **RustDesk Service** 添加持续的服务检查。将 "Install Rustdesk" 脚本添加为补救步骤。
        4. 添加 "Write Rustdesk ID and Password" 脚本并设置为每天在你偏好的时间重复运行。
        5. **保存**并**分发**策略。
      </Step>

      <Step title="创建快捷方式。">
        1. 导航到 **[Asset Shortcuts](https://app.gorelo.io/Admin/admin-settings#asset#assetshortcuts)。**
        2. 添加一个新快捷方式，详细信息如下：
           * **Name**：`RustDesk`
           * **URL**：`rustdesk://{{\$gorelo:asset.rustdeskID}}?password={{\$gorelo:asset.rustdeskPassword}}`
           * **Pinned Name**：`RustDesk`

        <Frame>
          <img src="https://mintcdn.com/gorelo/lqwr7vR8TnJnU6L2/images/image-101.png?fit=max&auto=format&n=lqwr7vR8TnJnU6L2&q=85&s=9be09dfa8c0571ab242e690fe0b81d75" alt="Image" width="776" height="756" data-path="images/image-101.png" />

          你现在应该会在资产详情页右上角看到 **RustDesk** 快捷方式。如果脚本成功填充了自定义字段，那么此快捷方式将启动 RustDesk 应用程序。
        </Frame>

        Bitdefender 安装 exe 的 URL 应类似如下（虚构示例）：

        [https://cloudgz.gravityzone.bitdefender.com/Packages/BSTWIN/0/setupdownloader\_\[aHR0cHM6Ly9jbG91ZGdLWDawWVjcy5ncR5em9uZS5iaXRkZWZl3ddwawGfawdmRlci5jb20vUGFja2FnZXMvQlNUV0lOLzAvdkluc3RhbGxlci54bw-bGFuZz1lbi1VUw==\].exe](https://cloudgz.gravityzone.bitdefender.com/Packages/BSTWIN/0/setupdownloader_\[aHR0cHM6Ly9jbG91ZGdLWDawWVjcy5ncR5em9uZS5iaXRkZWZl3ddwawGfawdmRlci5jb20vUGFja2FnZXMvQlNUV0lOLzAvdkluc3RhbGxlci54bw-bGFuZz1lbi1VUw==].exe)
      </Step>
    </Steps>
  </Tab>
</Tabs>
