PowerShell을 사용하여 Windows Admin Center 설정 관리
여러 Windows Admin Center 서버가 있는 대규모 조직인 경우 PowerShell을 사용하여 여러 서버의 연결 및 확장 목록을 한 번에 구성할 수 있습니다.
PowerShell을 사용하여 연결 가져오기 또는 내보내기(tags 사용)
# Load the module
Import-Module "$env:ProgramFiles\windows admin center\PowerShell\Modules\ConnectionTools"
# Available cmdlets: Export-Connection, Import-Connection
# Export connections (including tags) to a .csv file
Export-Connection "https://wac.contoso.com" -fileName "WAC-connections.csv"
# Import connections (including tags) from a .csv file
Import-Connection "https://wac.contoso.com" -fileName "WAC-connections.csv"
# Import connections (including tags) from .csv files, and remove any connections that are not explicitly in the imported file by using the -prune switch parameter
Import-Connection "https://wac.contoso.com" -fileName "WAC-connections.csv" -prune
연결을 가져오기 위한 CSV 파일 형식
CSV 파일의 형식은 다음 네 개의 제목으로 시작하고 새 줄의 각 연결로 시작합니다.
name
: 연결의 FQDN입니다.type
: 연결 유형입니다. Windows Admin Center에 포함된 기본 연결의 경우 다음 문자열 중 하나를 사용합니다.연결 유형 연결 문자열 Windows Server msft.sme.connection-type.server
장애 조치 클러스터 msft.sme.connection-type.cluster
tags
: 파이프로 구분된 태그입니다.groupId
: 공유 연결을 위한 열입니다. 이 열의global
값을 사용하여 공유 연결을 만듭니다.
참고
공유 연결 수정은 게이트웨이 관리자로 제한됩니다. 모든 사용자는 PowerShell을 사용하여 개인 연결 목록을 수정할 수 있습니다.
연결을 가져오기 위한 CSV 파일 예제
"name","type","tags","groupId"
"myServer.contoso.com","msft.sme.connection-type.server","hyperv"
"myDesktop.contoso.com","msft.sme.connection-type.windows-server","hyperv"
"teamcluster.contoso.com","msft.sme.connection-type.cluster","legacyCluster|WS2016","global"
"myHCIcluster.contoso.com,"msft.sme.connection-type.cluster","myHCIcluster|hyperv|JIT|WS2019"
"teamclusterNode.contoso.com","msft.sme.connection-type.server","legacyCluster|WS2016","global"
"myHCIclusterNode.contoso.com","msft.sme.connection-type.server","myHCIcluster|hyperv|JIT|WS2019"
참고
CSV 파일은 대/소문자를 구분합니다.
RDCMan 연결 가져오기
다음 스크립트를 사용하여 RDCMan 저장된 연결을 파일로 내보냅니다. 그런 다음, 파일을 Windows Admin Center로 가져오고 태그를 사용하여 RDCMan 그룹화 계층 구조를 유지할 수 있습니다.
다음 코드를 복사하여 PowerShell 세션에 붙여넣습니다.
#Helper function for RdgToWacCsv function AddServers { param ( [Parameter(Mandatory = $true)] [Xml.XmlLinkedNode] $node, [Parameter()] [String[]] $tags, [Parameter(Mandatory = $true)] [String] $csvPath ) if ($node.LocalName -eq 'server') { $serverName = $node.properties.name $tagString = $tags -join "|" Add-Content -Path $csvPath -Value ('"'+ $serverName + '","msft.sme.connection-type.server","'+ $tagString +'"') } elseif ($node.LocalName -eq 'group' -or $node.LocalName -eq 'file') { $groupName = $node.properties.name $tags+=$groupName $currNode = $node.properties.NextSibling while ($currNode) { AddServers -node $currNode -tags $tags -csvPath $csvPath $currNode = $currNode.NextSibling } } else { # Node type isn't relevant to tagging or adding connections in Windows Admin Center } return } <# .SYNOPSIS Convert an .rdg file from Remote Desktop Connection Manager into a .csv that can be imported into Windows Admin Center, maintaining groups via server tags. This will not modify the existing .rdg file and will create a new .csv file .DESCRIPTION This converts an .rdg file into a .csv that can be imported into Windows Admin Center. .PARAMETER RDGfilepath The path of the .rdg file to be converted. This file will not be modified, only read. .PARAMETER CSVdirectory Optional. The directory you want to export the new .csv file. If it's not provided, the new file is created in the same directory as the .rdg file. .EXAMPLE C:\PS> RdgToWacCsv -RDGfilepath "rdcmangroup.rdg" #> function RdgToWacCsv { param( [Parameter(Mandatory = $true)] [String] $RDGfilepath, [Parameter(Mandatory = $false)] [String] $CSVdirectory ) [xml]$RDGfile = Get-Content -Path $RDGfilepath $node = $RDGfile.RDCMan.file if (!$CSVdirectory){ $csvPath = [System.IO.Path]::GetDirectoryName($RDGfilepath) + [System.IO.Path]::GetFileNameWithoutExtension($RDGfilepath) + "_WAC.csv" } else { $csvPath = $CSVdirectory + [System.IO.Path]::GetFileNameWithoutExtension($RDGfilepath) + "_WAC.csv" } New-item -Path $csvPath Add-Content -Path $csvPath -Value '"name","type","tags"' AddServers -node $node -csvPath $csvPath Write-Host "Converted $RDGfilepath `nOutput: $csvPath" }
CSV 파일을 만들려면 다음 명령을 실행합니다.
RdgToWacCsv -RDGfilepath "path\to\myRDCManfile.rdg"
결과 CSV 파일을 Windows Admin Center로 가져옵니다. 연결 목록의 태그는 RDCMan 그룹화 계층 구조를 나타냅니다.
PowerShell을 사용하여 Windows Admin Center 확장 관리
# Add the module to the current session
Import-Module "$env:ProgramFiles\windows admin center\PowerShell\Modules\ExtensionTools"
# Available cmdlets: Get-Feed, Add-Feed, Remove-Feed, Get-Extension, Install-Extension, Uninstall-Extension, Update-Extension
# List feeds
Get-Feed "https://wac.contoso.com"
# Add a new extension feed
Add-Feed -GatewayEndpoint "https://wac.contoso.com" -Feed "\\WAC\our-private-extensions"
# Remove an extension feed
Remove-Feed -GatewayEndpoint "https://wac.contoso.com" -Feed "\\WAC\our-private-extensions"
# List all extensions
Get-Extension "https://wac.contoso.com"
# Install an extension (locate the latest version from all feeds and install it)
Install-Extension -GatewayEndpoint "https://wac.contoso.com" "msft.sme.containers"
# Install an extension (latest version from a specific feed, if the feed is not present, it will be added)
Install-Extension -GatewayEndpoint "https://wac.contoso.com" "msft.sme.containers" -Feed "https://aka.ms/sme-extension-feed"
# Install an extension (install a specific version)
Install-Extension "https://wac.contoso.com" "msft.sme.certificate-manager" "0.133.0"
# Uninstall-Extension
Uninstall-Extension "https://wac.contoso.com" "msft.sme.containers"
# Update-Extension
Update-Extension "https://wac.contoso.com" "msft.sme.containers"
참고
PowerShell을 사용하여 Windows Admin Center 확장을 수정하려면 게이트웨이 관리자여야 합니다.
추가 참조
- 클러스터에 고가용성의 Windows Admin Center 게이트웨이 배포
- Cloud Shell을 사용하여 Azure에서 Windows Admin Center 게이트웨이를 배포하십시오.