다음을 통해 공유


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 using the -prune switch parameter 
Import-Connection "https://wac.contoso.com" -fileName "WAC-connections.csv" -prune

연결을 가져오기 위한 CSV 파일 형식

CSV 파일의 형식은 네 개의 제목("name","type","tags","groupId")으로 시작하고, 그 뒤의 새 줄에 각 연결이 나옵니다.

name은 연결의 FQDN입니다.

type은 연결 형식입니다. Windows Admin Center에 포함된 기본 연결의 경우 다음 중 하나를 사용합니다.

Connection type Connection string
Windows Server msft.sme.connection-type.server
장애 조치(Failover) 클러스터 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 그룹화 계층 구조를 유지 관리할 수 있습니다. 기능 직접 사용해 보기

  1. 아래 코드를 복사하여 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 WAC
     }
     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 wish to export the new .csv file. If 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"
    }
    
  2. .CSV 파일을 만들려면 다음 명령을 실행합니다.

    RdgToWacCsv -RDGfilepath "path\to\myRDCManfile.rdg"
    
  3. 결과 .CSV 파일을 Windows Admin Center에 가져옵니다. 그러면 모든 RDCMan 그룹화 계층 구조가 연결 목록의 태그로 표시됩니다. 자세한 내용은 PowerShell을 사용하여 연결 가져오기 또는 내보내기(tags 사용)를 참조하세요.

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 확장을 수정하려면 게이트웨이 관리자여야 합니다.

추가 참조