Methods to run RDM Synchronizer via Powershell appear to require interact with Desktop
Do you have any working examples of running RDM sync via powershell quietly so it can run under Task Scheduler? ($RDMVersion = "11.6.0")
BTW/ I've had to run my powershell script on my server as elevated in order to access registry keys to load the snap-in.
Using "Open-RDMSession -ID $SyncTempGuid" loads RDM and brings the UI to the foreground. Does not exit upon completion. Bad behavior..
Running the below also loads the UI and leaves the powershell command shell hung after calling the below. The sync does work, but hangs the session since it does not exit. Even a manual close of RDM does not clear the powershell session.
# Run external RBM sync command
$CMD = "C:\Program Files (x86)\Devolutions\Remote Desktop Manager\RemoteDesktopManager.exe"
$cArg1 = '/DataSource:14c48a43-90fa-4b5f-b336-6d72435d948c'
$cArg2 = '/Session:70f95193-e15b-4ab7-bcb8-47513b0e7c07'
& $CMD $cArg1 $cArg2
-Stu
Hello,
We currently do not support this. Would a command line argument to close RDM after synchronizing be what you're looking for? It would be good to have something similar in the powershell commands too.
Regards,
Hubert Mireault
Hubert,
I would have never expected that automated actions like synchronize would require the UI with either the command-line or powershell cmdlets.
These actions should be able to run unattended within a Windows service.
The preferred supported method moving forward on the Windows platform should be your Powershell cmdlets and it should never REQUIRE any UI components. UI could be optional for some commands.
I had to try the command-line sync since "Open-RDMSession -ID $SyncTempGuid" loaded the UI. For the command line for someone who only can do batch\cmd scripting the "RemoteDesktopManager /quiet" method should be completly non-interactive. Currently it loads the UI to the taskbar.
Requiring a active desktop logon session on a server to run a script is not reliable. My goal was to have my scheduled SQL stored procedure which maintains our customer forest server records execute a RDM sync Powershell script every 4 hours.
Best, Stu
Hi Stuart,
We are currently working on a PowerShell module. We will implement a way to run a synchronizer without showing any UI in our new cmdlets.
Best regards,
Olivier Désalliers
I can help test when you are ready.
Thanks, Stu
Olivier, any update on this?
Hi Stuart,
This will be possible in RDM 12 with the new PowerShell Module. All you will need to do is to add the parameter Silent in the Open-RDMSession cmdlet.[font="Open Sans", sans-serif] Open-RDMSession -ID $SyncTempGuid -Silent[/font]
Best regards,
Olivier Désalliers
Thanks. I'm excited!
Updated to 12.0.8.0 RDM
Open-RDMSession -ID $SyncTempGuid -Silent
.
The above PS Open-RDMSession command throws error:
Open-RDMSession : A parameter cannot be found that matches parameter name 'Silent'.
At C:\EdgeTG Scripts\RDMSync-EdgeTGCustForests.ps1:149 char:36
+ Open-RDMSession -ID $SyncTempGuid -Silent
+ ~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Open-RDMSession], ParameterBindingException
+ FullyQualifiedErrorId : NamedParameterNotFound,Devolutions.RemoteDesktopManager.Business.PS.Commands.OpenRDMSess
ionCommand
Hi Stuart,
Are you using the new RDM PowerShell module in your script?
The RDM PowerShell module is located where you installed RDM.
For exemple, you would import the module this way if you installed RDM at the default location:[color=rgb(69, 69, 69)][font="Helvetica Neue"]Import-Module "C:\Program Files (x86)\Devolutions\Remote DesktopManager\RemoteDesktopManager.PowerShellModule.psd1"[/font][/color]
Best regards,
Olivier Désalliers
Yes, loading it differently as per earlier examples:
$RDMPath = "C:\Program Files (x86)\Devolutions\Remote Desktop Manager"
$RDMVersion = "12.0.8"
#set-alias installutil "$([System.Runtime.InteropServices.RuntimeEnvironment]::GetRuntimeDirectory())installutil.exe"
#installutil "$RDMPath\RemoteDesktopManager.PowerShell.dll"
if ( (Get-PSSnapin -Name Remote.Desktop.Manager.$RDMVersion -ErrorAction SilentlyContinue) -eq $null ) { Add-PsSnapin Remote.Desktop.Manager.$RDMVersion }
-Stu
Hi Stuart,
Your exemple loads the snap-in. It's still available for backward compatibility but it doesn't contain the new features like the silent parameter in the Open-RDMSession cmdlet that are only available in the module.
Best regards,
Olivier Désalliers
So you are saying the method of initializing RDM Powershell will determine the PowerShell features?
I guess I need an example for the updated RDM powershell on how to load RDM into an powershell session?
Loaded the new module and debugging the breakage.
I am running RDM 12.0.8 Enterprise Edition Trial.
Get-RDMDataSource is failing with:
Get-RDMDataSource : The PowerShell CmdLet feature is only available in the Enterprise Edition!
At C:\EdgeTG Scripts\RDMSync-EdgeTGCustForests.ps1:66 char:11
+ $RDM_DS = Get-RDMDataSource
+
Hi Stuart,
If you open PowerShell in RDM via Tools->PowerShell (RDM CmdLet). Do you have the same error?
Best regards,
Olivier Désalliers
PowerShellRDMCmdletTools.PNG
I had to open a duplicate Powershell session with Administrative permissions. Open-RDMsession appeared to work.
Still getting this error when running the script externally in PS.
I am running RDM 12.0.8 Enterprise Edition Trial.
Get-RDMDataSource is failing with:
Get-RDMDataSource : The PowerShell CmdLet feature is only available in the Enterprise Edition!
At C:\EdgeTG Scripts\RDMSync-EdgeTGCustForests.ps1:66 char:11
+ $RDM_DS = Get-RDMDataSource
Hi,
If it works in RDM but not externally it means that the module doesn't load the right config file. Can you verify if you have multiple RemoteDesktopManager.cfg files on your machine?
Best regards,
Olivier Désalliers
Only have one config file:
C:\>dir RemoteDesktopManager.cfg /s
Volume in drive C has no label.
Volume Serial Number is F250-5AE7
Directory of C:\Users\sschifter\AppData\Roaming\Devolutions\RemoteDesktopManage
r
01/18/2017 09:13 AM 7,692 RemoteDesktopManager.cfg
1 File(s) 7,692 bytes
Total Files Listed:
1 File(s) 7,692 bytes
0 Dir(s) 21,353,816,064 bytes free
C:\>
Hello,
The roaming part of your path indicates that your are not running in a plain desktop session, but maybe under TS?
We've reached the point where its best to transfer this case to a support agent, we will be in a position to have a remote session with you to see the issue in action.
Please contact us at support@devolutions.net to get the process started.
Maurice
Hello,
@everyone, through the remote session, we have found that PowerGui editor application is causing an issue with our PowerShell module. Using Windows PowerShell ISE resolve the issue for @Stuart.
Best regards,
Érica Poirier