Forum Discussion
Davey Rance
Mar 10, 2021Copper Contributor
Poweshell Export-Connection gives error using WAC 2103
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
- 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)
- RClochertyCopper Contributor
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.
- ms638Copper ContributorHaving the same issue
- Davey RanceCopper ContributorSo 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)
- HGroenertCopper ContributorAnother 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... - jensenjk2485Copper ContributorHi, any solution on this issue - I'm encountering this fault also
- HGroenertCopper ContributorAs 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 - Davey RanceCopper ContributorRoll back to 2009. Still waiting for new released build to address issues.
- Davey RanceCopper Contributorhttps://techcommunity.microsoft.com/t5/windows-admin-center-blog/windows-admin-center-version-2103-2-preview-is-now-available/ba-p/2369884
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.