PowerShell module errors

PowerShell module errors

avatar

I'm trying to use New-DSRDPEntry and New-DSSSHShellEntry to create new RDP and SSH Shell sessions using PowerShell 7.2.1. The PowerShell module is the newest one from PSGallery, 2021.6.3.

If i manually load the class "Field" from the module files the command still fails but with another error.

The commands fail with the following error:
forum image

All Comments (7)

avatar

Hello,

Thank you for letting us know about this issue. I have advised the engineer and there should be a new release in the PSGallery with the fix for this issue shortly.
Once it is posted, I will let you know.

Best regards,
Eric

Eric St-Martin

avatar

Hello Eric

Thanks for the information.
At the moment i have made som workarounds where i use New-DSEntryBase instead.

Best regards
Thomas

avatar

Hi All

Still the Same Error available.
Workaround by changing [Field[]]$NewFieldsList to $NewFieldsList = @{}

Best Regards,
Andreas

avatar

Hi Andreas,

As I understand, your workaround regards the [Field[]]$NewFieldsList that you modified to $NewFieldsList = @{}, am I right?

If so, we will update the cmdlet on GitHub.

Best regards,

Érica Poirier

avatar

Hi Erica

Yes exactly, that worked on my side.
Maybe an additional declaration as [object] would be great:
[object]$NewFieldsList = @{}

Best Regards
Andreas

avatar

Hi Andreas,

The "Field" structure gets properly loaded with the module in recent versions of the module. The "Field" structure needs to be respected or the CMDlet won't work with those fields. Here's how to use it;

$descField = [Field]::new('description', 'root', 'this is a desc')
        
$RequestParams = @{
	Name = 'NewRDPEntry'
	Username = 'username'
	NewFieldsList = @($descField)
	Host = 'newhost'
}

$res = New-DSRDPEntry @RequestParams


Using "NewFieldsList" require some knowledge as to where the property go in our "Connection" object. In this exemple, "Description" is found at the root of the object.

Best regards,

Alexandre Martigny

avatar
Hi Andreas,

The "Field" structure gets properly loaded with the module in recent versions of the module. The "Field" structure needs to be respected or the CMDlet won't work with those fields. Here's how to use it;
$descField = [Field]::new('description', 'root', 'this is a desc')
       
$RequestParams = @{
Name = 'NewRDPEntry'
Username = 'username'
NewFieldsList = @($descField)
Host = 'newhost'
}

$res = New-DSRDPEntry @RequestParams
Using "NewFieldsList" require some knowledge as to where the property go in our "Connection" object. In this exemple, "Description" is found at the root of the object.

Best regards,


Hey Alex

Thanks for your Example!
The Problem is not that im not able to use this Field, it is that the Type "Field" is not found or recognized.

Maybe there is a Problem in the Declaration File which isnt loaded properly?

Best Regards,
Andreas