Mar 10 2021 05:58 AM - edited Mar 10 2021 06:01 AM
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
Mar 12 2021 03:59 AM
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.
Mar 12 2021 07:01 AM
Mar 18 2021 04:24 AM
SolutionMay 18 2021 05:13 AM
May 20 2021 12:19 PM
May 21 2021 04:25 AM
May 21 2021 04:46 AM
May 21 2021 05:46 AM
May 30 2021 01:53 AM
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.