Notatka
Dostęp do tej strony wymaga autoryzacji. Może spróbować zalogować się lub zmienić katalogi.
Dostęp do tej strony wymaga autoryzacji. Możesz spróbować zmienić katalogi.
Jeśli masz dużą organizację z wieloma serwerami programu Windows Admin Center, możesz użyć programu PowerShell do skonfigurowania listy połączeń i rozszerzeń na wielu serwerach jednocześnie.
Importowanie lub eksportowanie połączeń za pomocą programu PowerShell (z tagami)
# Load the module
Import-Module "$env:'Program Files'\WindowsAdminCenter\PowerShellModules\Microsoft.WindowsAdminCenter.ConnectionTools"
# Available cmdlets: Export-WACConnection, Import-WACConnection
# Export connections (including tags) to a .csv file
Export-WACConnection "https://wac.contoso.com" -fileName "WAC-connections.csv"
# Import connections (including tags) from a .csv file
Import-WACConnection "https://wac.contoso.com" -fileName "WAC-connections.csv" -AccessKey "<key string>"
# 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-WACConnection "https://wac.contoso.com" -fileName "WAC-connections.csv" -AccessKey "<key string>" -prune
Ważna
Pole -AccessKey jest wymagane podczas importowania połączeń, ale nie jest wymagane do eksportowania połączeń. Klucz dostępu Windows Admin Center można znaleźć na karcie Advanced w ustawieniach Windows Admin Center.
Jeśli do uzyskiwania dostępu do Windows Admin Center używasz uwierzytelniania za pomocą formularza logowania, musisz podać poświadczenia, aby importować i eksportować połączenia. Możesz przekazać dane logowania za pomocą następującego polecenia:
# Export connections by using credentials
Export-WACConnection "https://wac.contoso.com" -fileName "WAC-connections.csv" -AccessKey "<key string>" -Credentials (Get-Credential)
# Import connections by using credentials
Import-WACConnection -Endpoint "https://wac.contoso.com" -FileName "WAC-connections.csv" -AccessKey "<key string>" -Credentials (Get-Credential)
Format pliku CSV do importowania połączeń
Format pliku CSV rozpoczyna się od następujących czterech nagłówków, po których następuje każde połączenie w nowym wierszu.
name: nazwa FQDN połączenia.type: typ połączenia. W przypadku domyślnych połączeń dołączonych do programu Windows Admin Center użyj jednego z następujących ciągów:Typ połączenia Łańcuch połączenia Serwer z systemem Windows msft.sme.connection-type.serverKlaster awaryjny msft.sme.connection-type.clustertags: tagi rozdzielone pionowymi kreskami.groupId: kolumna dla połączeń udostępnionych. Użyj wartościglobalw tej kolumnie, aby nawiązać połączenie współdzielone.
Note
Modyfikowanie połączeń udostępnionych jest ograniczone do administratorów bramy. Każdy użytkownik może użyć programu PowerShell do zmodyfikowania swojej osobistej listy połączeń.
Przykładowy plik CSV do importowania połączeń
"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"
Note
W pliku CSV jest uwzględniana wielkość liter.
Importowanie połączeń RDCMan
Użyj następującego skryptu, aby wyeksportować zapisane połączenia w usłudze RDCMan do pliku. Następnie możesz zaimportować plik do Centrum administracyjnego systemu Windows i zachować hierarchię grupowania RDCMan przy użyciu tagów.
Skopiuj i wklej następujący kod do sesji programu 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" }Aby utworzyć plik CSV, uruchom następujące polecenie:
RdgToWacCsv -RDGfilepath "path\to\myRDCManfile.rdg"Zaimportuj wynikowy plik CSV do centrum administracyjnego systemu Windows. Tagi na liście połączeń reprezentują hierarchię grupowania RDCMan.
Zarządzanie rozszerzeniami programu Windows Admin Center za pomocą programu PowerShell
# 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"
Note
Aby zmodyfikować rozszerzenia programu Windows Admin Center za pomocą programu PowerShell, musisz być administratorem bramy.