Create a new data source with Powershell

Create a new data source with Powershell

avatar
maxime
Disabled

Hi

I'm trying to create a new data source via a Powershell script.


$dataSource = New-RDMDataSource -Name "New Datasource" -Type "XML"
Set-RDMDataSourceProperty -DataSource $dataSource -Property "FileName" -Value "C:\path\to\file.rdm"
Set-RDM-DataSource $dataSource


When I try to run that, I get the following error:


Set-RDM-DataSource : Impossible de lier le paramètre « ID ». Impossible de convertir la valeur « New Datasource » du type « Devolutions.RemoteDesktopManager.Business.DataSources.XmlConnectionDataSource » en type « System.Guid ».
Au caractère Ligne:1 : 21
+ Set-RDM-DataSource $dataSource
+ ~~~~~~~~~~~
+ CategoryInfo : InvalidArgument : (:) [Set-RDM-DataSource], ParameterBindingException
+ FullyQualifiedErrorId : CannotConvertArgumentNoMessage,Devolutions.RemoteDesktopManager.Business.PS.Commands.SetRDMDatasourceCommandClassic


I also tried the following:


PS C:\WINDOWS\system32> Set-RDM-DataSource -ID $dataSource.ID

But I get the error:

WARNING: Connection not found.



What am I doing wrong ?

All Comments (1)

avatar

Hello,

Could you please try to run this cmdlet? It will only require the DataSource object as the parameter.

Set-RDMDataSource $dataSource
The Set-RDM-DataSource is one of the cmdlet that has been deprecated. Here is a link on all of these deprecated cmdlets http://help.remotedesktopmanager.com/powershell_cmdlets_deprecated.htm.

With the old cmdlet, this is the correct form to use it without specifying the "-ID" :

Set-RDM-DataSource $dataSource.ID
But we recommend to use the newest cmdlet Set-RDMDataSource.

Best regards,

Érica Poirier