Windows Server Summit 2024
Mar 26 2024 08:00 AM - Mar 28 2024 04:30 PM (PDT)
Microsoft Tech Community
LIVE
SOLVED

WAC 2103 Export-Connection gives error

Copper Contributor

I get an error when trying to export my server list connections - any ideas?

I have a lot of servers entered - I would feel a lot more comfortable with a backup of them...

PS C:\Users\grma> Import-Module "$env:ProgramFiles\windows admin center\PowerShell\Modules\ConnectionTools"
PS C:\Users\grma> Export-Connection "https://localhost" -fileName "WAC-connections.csv"
Invoke-WebRequest : Unable to connect to the remote server
At C:\Program Files\windows admin center\PowerShell\Modules\ConnectionTools\ConnectionTools.psm1:75 char:17
+     $response = Invoke-WebRequest @params
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest], WebExc
   eption
    + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand

Failed to get the connections
At C:\Program Files\windows admin center\PowerShell\Modules\ConnectionTools\ConnectionTools.psm1:77 char:9
+         throw "Failed to get the connections"
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (Failed to get the connections:String) [], RuntimeException
    + FullyQualifiedErrorId : Failed to get the connections
11 Replies
I can export connection,
if you use WAC version 2103, please update to version 2103.2 and try again.
I have just updated to 2103.2 and still get the same issue.

Is it because I am not using a FQDN like in the example - my host connects using https://localhost in a browser?

try this command,

 

Export-Connection "https://localhost" -Credential $(Get-Credential)

@Deleted

 

Still does not work (using either user or admin PS session):

 

garymansell_0-1623311531133.png

 

 

try this command

Invoke-WebRequest "https://localhost" -Verbose

@Deleted 

garymansell_0-1623312659023.png

 

5.png

 

if the response code does not equal 200, it will response "Failed to get the connections" to you,

so, please run "Invoke-WebRequest "https://localhost" -Verbose" to get http response code.

@Deleted 

 

I can access the Admin center via browser and I have temporarily disabled the windows firewall.

This is the error:

 

garymansell_0-1623327724538.png

 

best response confirmed by garymansell (Copper Contributor)
Solution

@garymansell 

 

try these commands,

 

Invoke-WebRequest "https://localhost:6516"


Export-Connection "https://localhost:6516" -fileName "WAC-connections.csv"

 

 

Perfect - putting the port number fixed it, thanks so much for your help.
1 best response

Accepted Solutions
best response confirmed by garymansell (Copper Contributor)
Solution

@garymansell 

 

try these commands,

 

Invoke-WebRequest "https://localhost:6516"


Export-Connection "https://localhost:6516" -fileName "WAC-connections.csv"

 

 

View solution in original post