Datasource System Message should not be displayed when calling RDM-SetDataSource from PowerShell

Datasource System Message should not be displayed when calling RDM-SetDataSource from PowerShell

avatar
zorglups
Disabled

Hello,

My powershell script does a RDM-SetDataSource.
My datasource features a System Message.

When launching the powershell script, the System Message pops up making unattended execution impossible.

The system message is intended to RDM UI users and we manage the RDM database through powershell scripts that are called in Amazon deployment scripts.
Those script should be executed unattended and therefore should never get blocked by that popup.

I also saw that if RDM is running while I launch the powershell in a separate powershell console, the popup happen twice. One for the powershell console and once from within the RDM UI.

Can you please correct this behaviour?

Thank you.

Pierre

All Comments (7)

avatar

Hello Pierre,

We will change this to ignore the system message if executing from Powershell. When the next minor version is out, could you try it and give us some feedback? When using Set-RDMDataSource I don't get the System Message anymore with that fix.

Regards,

Hubert Mireault

avatar

Hello Hubert,

Yes, I can beta test any version you like.
Thank you for the quick reaction (as usual).

Best regards,

Pierre

avatar

Hello Pierre,

The fix should be available in the latest version (11.5.3.0) which is up for download here http://remotedesktopmanager.com/Home/Download Could you try it out and see if it works as expected?

Regards,

Hubert Mireault

avatar

Hello Hubert,

I updated to the last beta and:
- The popup does not happen if RDM UI is not running when I start my script in a separate PS console.
- The popup happen if RDM UI is running when I start my script in a separate PS console.


PS C:\Users\phi> . C:\sbin\ps\RDMman\RDMmanLib.ps1
PS C:\Users\phi> RDM-EnvInit


The RDM-EnvInit function triggers the popup if RDM UI is running.
The line that triggers the popup is the one with RDM-SetDataSource.
Its code is the following:


function RDM-EnvInit {
param(
$DataSourceName = "MyDataSource"
)
### Setup the environment
Write-Host "Getting the environment ready. Please wait..." -ForegroundColor White

$oRegisteredSnapin = @(Get-PSSnapin -Name Remote.Desktop* -Registered | Select-Object -Last 1)
if ($oRegisteredSnapin.Count -eq 0) {
$RdmDll = "C:\Program Files (x86)\Devolutions\Remote Desktop Manager\RemoteDesktopManager.PowerShell.dll"
Write-Host "Registering $RdmDll" -ForegroundColor Yellow
set-alias installutil "$([System.Runtime.InteropServices.RuntimeEnvironment]::GetRuntimeDirectory())installutil.exe"
installutil $RdmDll;
$oRegisteredSnapin = @(Get-PSSnapin -Name Remote.Desktop* -Registered | Select-Object -Last 1) # -Registered
}

$oRegisteredSnapin | % { Write-Host "$_ ... " -NoNewline;
if ((Get-PSSnapin -Name $_ -ErrorAction SilentlyContinue) -eq $null) {
Write-Host "installing" -ForegroundColor Yellow;
Add-PsSnapin $_
}
else {
Write-Host "already installed" -ForegroundColor Green;
}
}

RDM-SetDataSource -DataSourceName $DataSourceName

}



Best regards,

Pierre

avatar

Hello,


This cmdlet does not exist. Lets book a remote session to see this in action. Please contact us at support@devolutions to get a booking link.

Best regards,

Maurice

avatar

Maurice,

I'm sorry. I forgot this cmdlet was another function of me. Here it is:


function RDM-SetDataSource {
param($DataSourceName)

Write-Host "Listing RDM datasources. Please wait..." -ForegroundColor White
Try {
$DataSources = Get-RDMDataSource -ErrorAction Stop| Where Name -eq $DataSourceName;
}
Catch {
Write-Host "FATAL: Error getting a list of RDP datasources." -ForegroundColor Red;
Exit;
}

Write-Host "Switching RDM datasources. Please wait..." -ForegroundColor White
Try {
Set-RDMDataSource -DataSource $DataSources[0] -ErrorAction Stop;
}
Catch {
Write-Host "FATAL: Could not switch to C-Cast DataSource." -ForegroundColor Red;
Exit;
}
}


Best regards,

Pierre

avatar

So to make it shorter, here are the 2 lines that bring the popup if 'MyDataSource' as a System Message and if RDM UI is running:

$DataSources = Get-RDMDataSource -ErrorAction Stop| Where Name -eq 'MyDataSource';
Set-RDMDataSource -DataSource $DataSources[0] -ErrorAction Stop;