CloudLink REST API를 사용하는 PowerShell 스크립트 예시
Resumen: 이 파일은 교육/정보 제공 전용입니다. PowerShell 스크립트 언어로 Cloudlink 자동화 스크립트를 작성할 때 참조로 사용할 수 있습니다. Dell은 이 파일이 Dell 고객 환경에서 PowerShell 스크립트로 실행되는 것에 대해 책임을 지지 않습니다. 이 스크립트는 Cloudlink RestAPI 호출을 사용하여 PowerShell 스크립트에서 Cloudlink에 등록된 시스템과 해당 드라이브를 나열하는 방법을 보여줍니다. 스크립트는 시스템의 상태를 변경하지 않고 정보만 표시합니다. Cloudlink 노드(IP 주소로 표시)에 대한 액세스 권한은 'client' 유형의 Cloudlink 사용자의 자격 증명으로 부여됩니다. ...
Este artículo se aplica a
Este artículo no se aplica a
Este artículo no está vinculado a ningún producto específico.
No se identifican todas las versiones del producto en este artículo.
Síntomas
이 스크립트를 사용하여 CloudLink 작업을 자동화할 수 있습니다. 이 예에서 스크립트는 Cloudlink Center에 등록된 시스템을 나열합니다.
Causa
이 스크립트는 Cloudlink Center가 여러 개 있거나 PowerShell 스크립트를 사용하여 Cloudlink Center를 관리하려는 고객에게 유용할 수 있습니다.
Resolución
# Copyright Dell © 2021, 2022
# 이 파일은 교육/정보 제공 목적으로만 사용됩니다.
# PowerShell 스크립트 언어로 Cloudlink 자동화 스크립트를 작성할 때 참조로 사용할 수 있습니다.
# Dell은 이 파일이 Dell 고객 환경에서 PowerShell 스크립트로 실행되는 것에 대해 책임을 지지 않습니다.
# 스크립트는 Cloudlink RestAPI 호출을 사용하여 PowerShell 스크립트에서 Cloudlink에 등록된 시스템과 해당 드라이브를 나열하는 방법을 보여줍니다.
# 스크립트는 시스템의 상태를 변경하지 않고 정보만 표시합니다.
# Cloudlink 노드(IP 주소로 표시)에 대한 액세스 권한은 'client' 유형의 Cloudlink 사용자의 자격 증명으로 부여됩니다.
# 다음 부분은 인증서 유효성 검사를 조롱하는 것이며 인증서는 항상 유효합니다.
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
if (-not ([System.Management.Automation.PSTypeName]'ServerCertificateValidationCallback').Type)
{
$certCallback = @"
using System;
using System.Net;
using System.Net.Security;
using System.Security.Cryptography.X509Certificates;
public class ServerCertificateValidationCallback
{
public static void Ignore()
{
if(ServicePointManager.ServerCertificateValidationCallback ==null)
{
ServicePointManager.ServerCertificateValidationCallback +=
delegate
(
Object obj,
X509Certificate certificate,
X509Chain chain,
SslPolicyErrors errors
)
{
return true;
};
}
}
}
"@
Add-Type $certCallback
}
[ServerCertificateValidationCallback]::Ignore()
$server='<cloudlink node ip>'
$client_id='<client id>'
$client_secret='<client secret>'
if ($args[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"
Write-Output "parameters: server=$server, client_id=$client_id, client_secret=$client_secret"
$responsee=Invoke-RestMethod -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
# 콘솔의 머신을 나열합니다.
Write-Host "Machine list:" -ForegroundColor Yellow $machine_list_txt = $machine_list | ConvertFrom-Json $machine_list_txt | FT
각 머신#For 드라이브를 나열합니다.
foreach ($machine in $machine_list_txt)
{
$drives_list = $($machine.resources)
Write-Host "$($machine.name) $($machine.ip_address) ($($machine.os_name)) group $($machine.group)" -ForegroundColor Yellow
$drives_list | FT
}
}
Productos afectados
CloudLink SecureVM, CloudLinkPropiedades del artículo
Número del artículo: 000202396
Tipo de artículo: Solution
Última modificación: 09 jun 2026
Versión: 7
Encuentre respuestas a sus preguntas de otros usuarios de Dell
Servicios de soporte
Compruebe si el dispositivo está cubierto por los servicios de soporte.