SOLVED

Poweshell Export-Connection gives error using WAC 2103

%3CLINGO-SUB%20id%3D%22lingo-sub-2199432%22%20slang%3D%22en-US%22%3EPoweshell%20Export-Connection%20gives%20error%20using%20WAC%202103%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2199432%22%20slang%3D%22en-US%22%3E%3CP%3EIt%20seems%20that%20the%20powershell%20cmdlets%20for%20exporting%20%2F%20importing%20connections%20are%20no%20longer%20working%20in%20WAC%202103%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESteps%20to%20re-produce%20the%20issue%20open%20powershell%20then%20run%20the%20following%20commands%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-powershell%22%3E%3CCODE%3EImport-Module%20%22%24env%3AProgramFiles%5Cwindows%20admin%20center%5CPowerShell%5CModules%5CConnectionTools%22%0AExport-Connection%20https%3A%2F%2F%24env%3Acomputername%0AInvoke-WebRequest%20%3A%20The%20remote%20server%20returned%20an%20error%3A%20(500)%20Internal%20Server%20Error.%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%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EOn%20checking%20the%20module%20versions%20it%20seems%20that%20the%20ConnectionTools%20module%20is%20now%20listed%20as%20version%200.0%20vs%200.1%20in%202009%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-applescript%22%3E%3CCODE%3EPS%20C%3A%5Ctemp%26gt%3B%20get-module%20-name%20ConnectionTools%0A%0AModuleType%20Version%20%20%20%20Name%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20ExportedCommands%0A----------%20-------%20%20%20%20----%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20----------------%0AScript%20%20%20%20%200.0%20%20%20%20%20%20%20%20ConnectionTools%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7BExport-Connection%2C%20Import-Connection%7D%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EOn%20trying%20to%20do%20an%20import%20with%20the%20new%20module%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-applescript%22%3E%3CCODE%3EPS%20C%3A%5Ctemp%26gt%3B%20Import-Connection%20https%3A%2F%2F%24env%3Acomputername%20-fileName%20.%5CWACReset.txt%0AConvertFrom-Json%20%3A%20Invalid%20JSON%20primitive%3A%20The.%0AAt%20C%3A%5CProgram%20Files%5Cwindows%20admin%20center%5CPowerShell%5CModules%5CConnectionTools%5CConnectionTools.psm1%3A206%20char%3A18%0A%2B%20%20%20%20%20%20%20%20%20%24error%20%3D%20ConvertFrom-Json%20%24_%0A%2B%20%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%20NotSpecified%3A%20(%3A)%20%5BConvertFrom-Json%5D%2C%20ArgumentException%0A%20%20%20%20%2B%20FullyQualifiedErrorId%20%3A%20System.ArgumentException%2CMicrosoft.PowerShell.Commands.ConvertFromJsonCommand%0A%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3EIt%20will%20then%20list%20out%20the%20servers%20that%20should%20have%20been%20added%20but%20dosnt%20apply%20them.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThis%20happened%20on%20a%202009%20-%26gt%3B%202103%20upgrade%20and%20also%20on%20a%20fresh%20install%20on%20a%20windows%2010%20Sandbox%20Machine.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2205006%22%20slang%3D%22en-US%22%3ERe%3A%20Poweshell%20Export-Connection%20gives%20error%20using%20WAC%202103%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2205006%22%20slang%3D%22en-US%22%3E%3CP%3EI%20am%20having%20the%20same%20issue%2C%20The%20import%20looks%20like%20it%20is%20working%20but%20nothing%20shows%20up%20under%20connections%20and%20I%20get%20the%20same%20error%20message%20trying%20to%20export.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F67099%22%20target%3D%22_blank%22%3E%40Davey%20Rance%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2205342%22%20slang%3D%22en-US%22%3ERe%3A%20Poweshell%20Export-Connection%20gives%20error%20using%20WAC%202103%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2205342%22%20slang%3D%22en-US%22%3EHaving%20the%20same%20issue%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2219698%22%20slang%3D%22en-US%22%3ERe%3A%20Poweshell%20Export-Connection%20gives%20error%20using%20WAC%202103%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2219698%22%20slang%3D%22en-US%22%3ESo%20the%20response%20that%20i%20have%20had%20from%20Microsoft%20as%20i%20opened%20a%20ticket%20is%20that%20it%20is%20confirmed%20that%20it%20is%20an%20issue%20and%20will%20be%20addressed%20in%20a%20future%20build.%20Currently%20the%20only%20option%20if%20you%20want%20to%20use%20powershell%20for%20doing%20imports%20is%20going%20back%20to%20previous%20build.%20(2009)%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2364010%22%20slang%3D%22en-US%22%3ERe%3A%20Poweshell%20Export-Connection%20gives%20error%20using%20WAC%202103%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2364010%22%20slang%3D%22en-US%22%3EAnother%20thing%20is%20that%20also%20the%20Feed-Cmdlets%20are%20not%20working%20anymore...%3CBR%20%2F%3EGet-Feed%3CBR%20%2F%3ERemove-Feed%3CBR%20%2F%3EAdd-Feed%3CBR%20%2F%3E%3CBR%20%2F%3EIs%20it%20possible%20to%20add%20this%20to%20the%20case%20you%20opened%2C%20too%3F%3F%3F%3CBR%20%2F%3E%3CBR%20%2F%3EI%20was%20able%20to%20Get-%20Remove-%20and%20Add-Feed%20with%20v2009%20but%20not%20with%202103...%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2373480%22%20slang%3D%22en-US%22%3ERe%3A%20Poweshell%20Export-Connection%20gives%20error%20using%20WAC%202103%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2373480%22%20slang%3D%22en-US%22%3EHi%2C%20any%20solution%20on%20this%20issue%20-%20I'm%20encountering%20this%20fault%20also%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2375382%22%20slang%3D%22en-US%22%3ERe%3A%20Poweshell%20Export-Connection%20gives%20error%20using%20WAC%202103%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2375382%22%20slang%3D%22en-US%22%3EAs%20Dave%20mentioned%20above%2C%20this%20seems%20a%20known%20issue%20at%20Microsoft%20and%20will%20be%20solved%20in%20the%20next%20release.%3CBR%20%2F%3EFor%20me%20it%20would%20be%20not%20a%20nice%20to%20have%2C%20but%20an%20urgent%20issue%2C%20because%20I%20install%20WAC%20on%20several%20servers%20and%20sync%20feed%2C%20extensions%2C%20etc.%2C%20so%20I%20don't%20have%20to%20do%20it%20all%20from%20scratch%20and%20by%20hand.%3CBR%20%2F%3EThat's%20why%20I%20would%20treat%20with%20more%20importance%20and%20not%20wait%20to%20%22a%20future%20build%22%3CBR%20%2F%3E%3CBR%20%2F%3EMaybe%20in%20the%20future%20Microsoft%20will%20handle%20such%20PS%20things%20for%20WAC%20more%20important%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2375419%22%20slang%3D%22en-US%22%3ERe%3A%20Poweshell%20Export-Connection%20gives%20error%20using%20WAC%202103%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2375419%22%20slang%3D%22en-US%22%3ERoll%20back%20to%202009.%20Still%20waiting%20for%20new%20released%20build%20to%20address%20issues.%3C%2FLINGO-BODY%3E
New Contributor

It seems that the powershell cmdlets for exporting / importing connections are no longer working in WAC 2103

 

Steps to re-produce the issue open powershell then run the following commands

 

 

Import-Module "$env:ProgramFiles\windows admin center\PowerShell\Modules\ConnectionTools"
Export-Connection https://$env:computername
Invoke-WebRequest : The remote server returned an error: (500) Internal Server Error.
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

 

 

 

On checking the module versions it seems that the ConnectionTools module is now listed as version 0.0 vs 0.1 in 2009

 

 

PS C:\temp> get-module -name ConnectionTools

ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Script     0.0        ConnectionTools                     {Export-Connection, Import-Connection}

 

 

 

On trying to do an import with the new module 

 

 

PS C:\temp> Import-Connection https://$env:computername -fileName .\WACReset.txt
ConvertFrom-Json : Invalid JSON primitive: The.
At C:\Program Files\windows admin center\PowerShell\Modules\ConnectionTools\ConnectionTools.psm1:206 char:18
+         $error = ConvertFrom-Json $_
+                  ~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [ConvertFrom-Json], ArgumentException
    + FullyQualifiedErrorId : System.ArgumentException,Microsoft.PowerShell.Commands.ConvertFromJsonCommand

 

 

It will then list out the servers that should have been added but dosnt apply them.

 

This happened on a 2009 -> 2103 upgrade and also on a fresh install on a windows 10 Sandbox Machine.

 

Windows Admin Center

Version
2103
Build
1.3.2103.01006
9 Replies

I am having the same issue, The import looks like it is working but nothing shows up under connections and I get the same error message trying to export.

 

@Davey Rance 

 

Having the same issue
best response confirmed by Davey Rance (New Contributor)
Solution
So the response that i have had from Microsoft as i opened a ticket is that it is confirmed that it is an issue and will be addressed in a future build. Currently the only option if you want to use powershell for doing imports is going back to previous build. (2009)
Another thing is that also the Feed-Cmdlets are not working anymore...
Get-Feed
Remove-Feed
Add-Feed

Is it possible to add this to the case you opened, too???

I was able to Get- Remove- and Add-Feed with v2009 but not with 2103...
Hi, any solution on this issue - I'm encountering this fault also
As Dave mentioned above, this seems a known issue at Microsoft and will be solved in the next release.
For me it would be not a nice to have, but an urgent issue, because I install WAC on several servers and sync feed, extensions, etc., so I don't have to do it all from scratch and by hand.
That's why I would treat with more importance and not wait to "a future build"

Maybe in the future Microsoft will handle such PS things for WAC more important
Roll back to 2009. Still waiting for new released build to address issues.
https://techcommunity.microsoft.com/t5/windows-admin-center-blog/windows-admin-center-version-2103-2...

This was published yesterday and one of the bug fixes lists.

PowerShell commands fixed
In the v2103 release, many users were unable to utilize PowerShell to manage their Windows Admin Center settings and connections. In this release, you should be able to effectively use these commands to configure your Windows Admin Center gateway.

@Davey Rance 

 

yes the Add-wacconnection is working with the new release,

 

however the remove-wacconnection is not - it seems to try to add something instead which gets denied.

I'll try to debug it somemore.