SOLVED

WAC 2103 Export-Connection gives error

%3CLINGO-SUB%20id%3D%22lingo-sub-2411791%22%20slang%3D%22en-US%22%3EWAC%202103%20Export-Connection%20gives%20error%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2411791%22%20slang%3D%22en-US%22%3E%3CP%3EI%20get%20an%20error%20when%20trying%20to%20export%20my%20server%20list%20connections%20-%20any%20ideas%3F%3C%2FP%3E%3CP%3EI%20have%20a%20lot%20of%20servers%20entered%20-%20I%20would%20feel%20a%20lot%20more%20comfortable%20with%20a%20backup%20of%20them...%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-powershell%22%3E%3CCODE%3EPS%20C%3A%5CUsers%5Cgrma%26gt%3B%20Import-Module%20%22%24env%3AProgramFiles%5Cwindows%20admin%20center%5CPowerShell%5CModules%5CConnectionTools%22%0APS%20C%3A%5CUsers%5Cgrma%26gt%3B%20Export-Connection%20%22https%3A%2F%2Flocalhost%22%20-fileName%20%22WAC-connections.csv%22%0AInvoke-WebRequest%20%3A%20Unable%20to%20connect%20to%20the%20remote%20server%0AAt%20C%3A%5CProgram%20Files%5Cwindows%20admin%20center%5CPowerShell%5CModules%5CConnectionTools%5CConnectionTools.psm1%3A75%20char%3A17%0A%2B%20%20%20%20%20%24response%20%3D%20Invoke-WebRequest%20%40params%0A%2B%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20~~~~~~~~~~~~~~~~~~~~~~~~~%0A%20%20%20%20%2B%20CategoryInfo%20%20%20%20%20%20%20%20%20%20%3A%20InvalidOperation%3A%20(System.Net.HttpWebRequest%3AHttpWebRequest)%20%5BInvoke-WebRequest%5D%2C%20WebExc%0A%20%20%20eption%0A%20%20%20%20%2B%20FullyQualifiedErrorId%20%3A%20WebCmdletWebResponseException%2CMicrosoft.PowerShell.Commands.InvokeWebRequestCommand%0A%0AFailed%20to%20get%20the%20connections%0AAt%20C%3A%5CProgram%20Files%5Cwindows%20admin%20center%5CPowerShell%5CModules%5CConnectionTools%5CConnectionTools.psm1%3A77%20char%3A9%0A%2B%20%20%20%20%20%20%20%20%20throw%20%22Failed%20to%20get%20the%20connections%22%0A%2B%20%20%20%20%20%20%20%20%20~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~%0A%20%20%20%20%2B%20CategoryInfo%20%20%20%20%20%20%20%20%20%20%3A%20OperationStopped%3A%20(Failed%20to%20get%20the%20connections%3AString)%20%5B%5D%2C%20RuntimeException%0A%20%20%20%20%2B%20FullyQualifiedErrorId%20%3A%20Failed%20to%20get%20the%20connections%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2414836%22%20slang%3D%22en-US%22%3ERe%3A%20WAC%202103%20Export-Connection%20gives%20error%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2414836%22%20slang%3D%22en-US%22%3EI%20can%20export%20connection%2C%3CBR%20%2F%3Eif%20you%20use%20WAC%20version%202013%2C%20please%20update%20to%20version%202013.2%20and%20try%20again.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2414839%22%20slang%3D%22en-US%22%3ERe%3A%20WAC%202103%20Export-Connection%20gives%20error%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2414839%22%20slang%3D%22en-US%22%3EI%20can%20export%20connection%2C%3CBR%20%2F%3Eif%20you%20use%20WAC%20version%202103%2C%20please%20update%20to%20version%202103.2%20and%20try%20again.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2421541%22%20slang%3D%22en-US%22%3ERe%3A%20WAC%202103%20Export-Connection%20gives%20error%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2421541%22%20slang%3D%22en-US%22%3EI%20have%20just%20updated%20to%202103.2%20and%20still%20get%20the%20same%20issue.%3CBR%20%2F%3E%3CBR%20%2F%3EIs%20it%20because%20I%20am%20not%20using%20a%20FQDN%20like%20in%20the%20example%20-%20my%20host%20connects%20using%20%3CA%20href%3D%22https%3A%2F%2Flocalhost%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Flocalhost%3C%2FA%3E%20in%20a%20browser%3F%3C%2FLINGO-BODY%3E
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)

@Jim Lin

 

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

 

garymansell_0-1623311531133.png

 

 

try this command

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

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.

@Jim Lin 

 

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 (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.