Cloudlink REST APIを使用したPowerShellスクリプトの例
Summary: このファイルは、教育/情報のみを目的としています。 PowerShellスクリプト言語を使用してCloudlink自動化スクリプトを記述する際の参照として使用できます。 デルのお客様の環境でPowerShellスクリプトとして実行されるこのファイルについては、デルは一切責任を負いません。 このスクリプトは、Cloudlink RestAPIコールを使用して、PowerShellスクリプトからCloudlinkに登録されているマシンとそのドライブを一覧表示する方法を示しています。 スクリプトはシステムの状態を変更せず、情報を表示するだけです。 Cloudlinkノードへのアクセス(IPアドレスで示される)には、「client」タイプのCloudlinkユーザーの認証情報が付与されます。 ...
Acest articol se aplică pentru
Acest articol nu se aplică pentru
Acest articol nu este legat de un produs specific.
Acest articol nu acoperă toate versiunile de produs existente.
Symptoms
スクリプトを使用して、Cloudlink操作を自動化できます。この例では、スクリプトにCloudlink Centerに登録されているマシンが一覧表示されています。
Cause
このスクリプトは、複数のCloudLink Centerを使用しているお客様や、PowerShellスクリプトを使用してCloudLink Centerを管理したいお客様に便利です。
Resolution
# Copyright Dell © 2021, 2022
# このファイルは教育/情報専用です。
#PowerShellスクリプト言語を使用してCloudlink自動化スクリプトを記述する際の参照として使用できます。
#デルは、このファイルがデルのお客様の環境
でPowerShellスクリプトとして実行される責任を負いません。 このスクリプトは、Cloudlinkに登録されているマシンとそのドライブを、Cloudlink RestAPIコールを使用してPowerShellスクリプト
番号から一覧表示する方法を示しています。
#スクリプトはシステムの状態を変更せず、情報を表示するだけです。
#Cloudlinkノードへのアクセス(IPアドレスで示される)には、「client」タイプのCloudlinkユーザーの認証情報が付与されます。
#次の部分は、証明書検証、証明書常に有効
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
if (-not([System.Management.Automation.PSTypeName]'ServerCertificateValidationCallback'))を模擬します。タイプ)
{
$certCallback = @"
using System;
System.Net
の使用 System.Net.Securityの
使用 System.Security.Cryptography.X509Certificatesの
使用 パブリック クラス ServerCertificateValidationCallback
{
public static void Ignore()
{
if(ServicePointManager.ServerCertificateValidationCallback ==null)
{
ServicePointManager.ServerCertificateValidationCallback +=
delegate
(
Object obj,
X509Certificate certificate,
X509 Chain,
SslPolicyErrors errors
)
{
return true;
};
}
}
"@
Add-Type $certCallback
}
[ServerCertificateValidationCallback]::Ignore()
$server=''
$client_id=''
$client_secret=''if
($args[1] 0] -ne $null)
{ $server=$args[0] }
if ($args[1] -ne $null)
{ $client_id=$args[1] }
if ($args[2] -ne $null)
{ $client_secret=$args[2] }
$serverport=$server+":443"
書き込み出力"パラメーター: server=$server, client_id=$client_id, client_secret=$client_secret」
$responsee=Invoke-RestDiscoveryod -Uri "https://$server/cloudlink/oauth/token?grant_type=client_credentials&client_id= $client_id&client_secret=$client_secret&scope=all" -Method Get -TimeoutSec 1800
Write-Output "The response received:"
Write-Output "$responsee"
if($
responsee.access_token)
{ $mytoken=$responsee.access_token
$Type = "application/json"
$resolveSessionHeader = @{'Authorization' = "Bearer $mytoken"}
# マシン リスト
のクエリー $machine_list_query='' https://$serverport/cloudlink/rest/securevm'
$machine_list=Invoke-WebRequest -Method Get -Uri $machine_list_query -Headers $resolveSessionHeader -ContentType $Type
# コンソール
にマシンを一覧表示する
書き込みホスト「マシン リスト:」 -ForegroundColor黄色
$machine_list_txt = $machine_list |ConvertFrom-Json
$machine_list_txt |FT
#For各マシンに対するドライブ
をリストします($machine_list_txtに$machine)
{
$drives_list = $($machine.resources)
Write-Host "$($machine.name) $($machine.ip_address) $($machine.ip_address) ($($machine.os_name)) group $($machine.group) -ForegroundColor Yellow
$drives_list |FT
}
}
# このファイルは教育/情報専用です。
#PowerShellスクリプト言語を使用してCloudlink自動化スクリプトを記述する際の参照として使用できます。
#デルは、このファイルがデルのお客様の環境
でPowerShellスクリプトとして実行される責任を負いません。 このスクリプトは、Cloudlinkに登録されているマシンとそのドライブを、Cloudlink RestAPIコールを使用してPowerShellスクリプト
番号から一覧表示する方法を示しています。
#スクリプトはシステムの状態を変更せず、情報を表示するだけです。
#Cloudlinkノードへのアクセス(IPアドレスで示される)には、「client」タイプのCloudlinkユーザーの認証情報が付与されます。
#次の部分は、証明書検証、証明書常に有効
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
if (-not([System.Management.Automation.PSTypeName]'ServerCertificateValidationCallback'))を模擬します。タイプ)
{
$certCallback = @"
using System;
System.Net
の使用 System.Net.Securityの
使用 System.Security.Cryptography.X509Certificatesの
使用 パブリック クラス ServerCertificateValidationCallback
{
public static void Ignore()
{
if(ServicePointManager.ServerCertificateValidationCallback ==null)
{
ServicePointManager.ServerCertificateValidationCallback +=
delegate
(
Object obj,
X509Certificate certificate,
X509 Chain,
SslPolicyErrors errors
)
{
return true;
};
}
}
"@
Add-Type $certCallback
}
[ServerCertificateValidationCallback]::Ignore()
$server=''
$client_id=''
$client_secret=''if
($args[1] 0] -ne $null)
{ $server=$args[0] }
if ($args[1] -ne $null)
{ $client_id=$args[1] }
if ($args[2] -ne $null)
{ $client_secret=$args[2] }
$serverport=$server+":443"
書き込み出力"パラメーター: server=$server, client_id=$client_id, client_secret=$client_secret」
$responsee=Invoke-RestDiscoveryod -Uri "https://$server/cloudlink/oauth/token?grant_type=client_credentials&client_id= $client_id&client_secret=$client_secret&scope=all" -Method Get -TimeoutSec 1800
Write-Output "The response received:"
Write-Output "$responsee"
if($
responsee.access_token)
{ $mytoken=$responsee.access_token
$Type = "application/json"
$resolveSessionHeader = @{'Authorization' = "Bearer $mytoken"}
# マシン リスト
のクエリー $machine_list_query='' https://$serverport/cloudlink/rest/securevm'
$machine_list=Invoke-WebRequest -Method Get -Uri $machine_list_query -Headers $resolveSessionHeader -ContentType $Type
# コンソール
にマシンを一覧表示する
書き込みホスト「マシン リスト:」 -ForegroundColor黄色
$machine_list_txt = $machine_list |ConvertFrom-Json
$machine_list_txt |FT
#For各マシンに対するドライブ
をリストします($machine_list_txtに$machine)
{
$drives_list = $($machine.resources)
Write-Host "$($machine.name) $($machine.ip_address) $($machine.ip_address) ($($machine.os_name)) group $($machine.group) -ForegroundColor Yellow
$drives_list |FT
}
}
Produse afectate
CloudLink SecureVM, CloudLinkProprietăți articol
Article Number: 000202396
Article Type: Solution
Ultima modificare: 15 mai 2026
Version: 6
Găsiți răspunsuri la întrebările dvs. de la alți utilizatori Dell
Servicii de asistență
Verificați dacă dispozitivul dvs. este acoperit de serviciile de asistență.