テナント上のすべてのクラウド PC のクラウド PC 名をエクスポートできます。
Intune 内で少なくともクラウド PC 閲覧者 RBAC ロールを持つユーザーを使用して、クラウド PC にサインインします。
PowerShell を開き、
Install-Module Microsoft.Graph -Scope CurrentUserと入力します。すべての確認ダイアログで Y と入力します。
インストールが完了するまで待ち、PowerShell を閉じます。
Visual Studio Code などのテキスト エディターを開きます。
新しいファイルに、次のスクリプトを貼り付けます。
param(
[Parameter(Mandatory)]
[string]$Output
)
Select-MgProfile -Name "beta"
Connect-MgGraph -Scopes "CloudPC.Read.All"
$CloudPCs = Get-MgDeviceManagementVirtualEndpointCloudPC -Property "DisplayName"
$DisplayNames = $CloudPCs | Select -ExpandProperty DisplayName
Write-Output $DisplayNames
$Outarray = @()
foreach ( $Name in $DisplayNames )
{
$Outarray += New-Object PsObject -property @{
'DisplayName' = $Name
}
}
$Outarray | Export-Csv -Path $Output -NoTypeInformation
Disconnect-MgGraph
- このファイルを “GetCloudPCNames.ps1” として任意の場所に保存します。
- ファイル エクスプローラーで、ファイルの場所に移動します。
- ファイルを右クリックし、[PowerShell で実行] を選択します。
- PowerShell ウィンドウが表示されます。 ウィンドウに "CloudPCNames.csv" と入力し、Enter キーを押します。
- 認証ウィンドウがポップアップ表示されたら、クラウド PC へのアクセスに使用したのと同じアカウントでサインインします。
PowerShell ウィンドウを閉じると、スクリプトの実行が完了しています。 スクリプトの場所に戻ると、"CloudPCNames.csv" と呼ばれるファイルが存在するでしょう。 このファイルには、テナント上のすべてのクラウド PC 名の一覧が含まれます。