Unable to schedule powershell task against Devolutions Servers
Hi
When trying to logon to Devolutions Server through my powershell-script via task scheduler I am not able to do so. I have tried running both elevated and non-elevated and my commands are like so:
New-RDMDataSource -DVLS -Server "http://server/dvls" -Name $dsname -SetDatasource
$datasource = Get-RDMDataSource -Name $dsname
$secpasswd = ConvertTo-SecureString "xxxxxxxx" -AsPlainText -Force
Set-RDMCurrentDataSource -DataSource $datasource -Username "user" -Password $secpasswd
I have also trying just getting the datasource if it exists.
The error I encounter is this:
WARNING: System.InvalidOperationException: Showing a modal dialog box or form when the application is not running in UserInteractive mode is not a valid operation. Specify the ServiceNotification or DefaultDesktopOnly style to display a notification from a service application.
Apperantly there is a prompt asking for username and password, I have found no way to avoid it.
Please advise! :)
Hello,
First, the powershell module is offered to interact with your LOCAL copy of RDM. This local copy may be bound to any datasource, namely your Devolutions Server.
Being that it interacts with RDM, it may needsto interact with the desktop. Have you tested your script to see if indeed there is a prompt? Until you have removed all of those, you cannot run in a non-interactive session as typically occurs when using the scheduler.
Best regards,
Maurice
Hi
When running it manually it does not generate any popups. But the same script does when running it via task scheduler.
Any ideas? How is the syntax supposed to be? Is mine correct? Any other way of communicating with the devolutions server to populate it with servers?
Regards Mats
Hello,
On the creation of the data source with the New-RDMDataSource cmdlet, you can provide the username and password. So the credentials will be saved directly in the data source and you shouldn't get the error message.$secpasswd = ConvertTo-SecureString "xxxxxxxx" -AsPlainText -ForceNew-RDMDataSource -DVLS -Server "http://server/dvls" -Name $dsname -SetDatasource -Username "user" -Password $secpasswd$datasource = Get-RDMDataSource -Name $dsname
It is also possible that you get a prompt because your default data source in RDM doesn't have any saved credentials. So, on the Import-Module process, by default it will load the default data source and this is probably why you get that error message. I would recommend to set a Local Data Source (SQLite) as the default data source in RDM to prevent this error message on the Import-Module process.
Best regards,
Érica Poirier
Thanks Erica! Starting RDM as the runas account and making sure everything was in order there did the trick!