RDM Powershell CMDLets and Shortcut

RDM Powershell CMDLets and Shortcut

avatar

Hi All,

I have successfully created a batch session creation powershell script but I would now like to just be able to double click a session to run the script. How do I a) correctly import the RDM modules via my script or b) run the RDM Cmdlets then load my script without having to open the CMDlets and then type the path of the script in.

I looked that the help on the CMDlets but it keeps telling me it's not registered

Thanks

Simon Watz
Senior Support Engineer | Strategic Group
Graduate Certificate in Networking & Systems Administration,
Microsoft Certified Technology Specialist

All Comments (18)

avatar

a) you need to add the snapin:
Add-PsSnapin Remote.Desktop.Manager.8.0.XX
(you current RDM version number)

if you want to load conditionaly:
if ( (Get-PSSnapin -Name Remote.Desktop.Manager.8.0.22 -ErrorAction SilentlyContinue) -eq $null ) { Add-PsSnapin Remote.Desktop.Manager.8.0.22 }

b) we would need to add the functionality, I've added it to our todo list

To list available snapins:
Get-PSSnapin-Registered

Note: Every time you install a new version of RDM you will need to register the new SnapIn & change you script to use the new SnapIn. The easiest way to register the new SnapIn is to run the PowerShell via the PowerShell (CdmLet) menu in RDM. It will register the new SnapIn for you.

Stéfane Lavergne

avatar

also if you have multiple data sources you might want to load the specific data source:

Set-RDM-DataSource -ID "8d9b43ce-7bbb-4f20-8ab6-76199fff2a1f";

The data source ID can be found in the Data Source edit window (bottom left)

Stéfane Lavergne

avatar

Thanks I will try this

Simon Watz
Senior Support Engineer | Strategic Group
Graduate Certificate in Networking & Systems Administration,
Microsoft Certified Technology Specialist

avatar

Sorry where am I adding this?
Is there anything else I need to put prior to this?

Simon Watz
Senior Support Engineer | Strategic Group
Graduate Certificate in Networking & Systems Administration,
Microsoft Certified Technology Specialist

avatar

added it to the top of you PowerShell script, prior to calling any RDM CmdLet

Stéfane Lavergne

avatar

I get

WARNING: The PowerShell CmdLet feature is only available in the Enterprise Edition!
Set-RDM-DataSource : Cannot bind argument to parameter 'ID' because it is null.
At C:\utils\posh\RDM-CreateCustomer\RDM-CreateCustomer.ps1:49 char:22
+ Set-RDM-DataSource $rdmds.ID
+ ~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Set-RDM-DataSource], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Devolutions.RemoteDesktopManager.Business
.PS.Commands.SetRDMDatasourceCommand

Simon Watz
Senior Support Engineer | Strategic Group
Graduate Certificate in Networking & Systems Administration,
Microsoft Certified Technology Specialist

avatar

You need RDM Enterprise Edition to use the RDM PowerShell CmdLet feature.

Stéfane Lavergne

avatar

I have a Global license, that why it is a problem.....

Simon Watz
Senior Support Engineer | Strategic Group
Graduate Certificate in Networking & Systems Administration,
Microsoft Certified Technology Specialist

avatar

What version do you have, we had a bug last week that loaded a different .cfg file when in PowerShell mode. That could explain the license issue.

Stéfane Lavergne

avatar

8.0.12

Simon Watz
Senior Support Engineer | Strategic Group
Graduate Certificate in Networking & Systems Administration,
Microsoft Certified Technology Specialist

avatar

try the new beta 8.0.23

http://download.devolutions.net/Devolutions.RemoteDesktopManager.Bin.8.0.23.0.zip

The license error should no longer be an issue.

Stéfane Lavergne

avatar

Thanks I will let you know how it goes.

Simon Watz
Senior Support Engineer | Strategic Group
Graduate Certificate in Networking & Systems Administration,
Microsoft Certified Technology Specialist

avatar

Just extract it to the Program Files (x86) folder?

Simon Watz
Senior Support Engineer | Strategic Group
Graduate Certificate in Networking & Systems Administration,
Microsoft Certified Technology Specialist

avatar

Get this when I run RDM CmdLet now
Add-PsSnapin : Cannot load Windows PowerShell Snap-In Remote.Desktop.Manager.8.0.23 because of the following error:
Could not load file or assembly 'file:///C:\Program Files (x86)\Devolutions\Remote Desktop
Manager\RemoteDesktopManager.PowerShell.dll' or one of its dependencies. Operation is not supported. (Exception from
HRESULT: 0x80131515)
At line:1 char:105
+ ... -eq $null ) { Add-PsSnapin Remote.Desktop.Manager.8.0.23 };Set-RDM-DataSource - ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (Remote.Desktop.Manager.8.0.23:String) [Add-PSSnapin], PSSnapInException
+ FullyQualifiedErrorId : AddPSSnapInRead,Microsoft.PowerShell.Commands.AddPSSnapinCommand

Set-RDM-DataSource : The term 'Set-RDM-DataSource' is not recognized as the name of a cmdlet, function, script file,
or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and
try again.
At line:1 char:150
+ ... nager.8.0.23 };Set-RDM-DataSource -ID '33b9d92b-74c1-4312-b91a-68f62e5d15f9'; }
+ ~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Set-RDM-DataSource:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException

Simon Watz
Senior Support Engineer | Strategic Group
Graduate Certificate in Networking & Systems Administration,
Microsoft Certified Technology Specialist

avatar

@Simon, we are looking into it. We don't why but it fails to load the dll if it's obfuscated which is odd since it worked last week. We are trying to figure out what the deal is. Sorry for the delay.

Stéfane Lavergne

avatar

@Simon are you running on Windows 8?

Stéfane Lavergne

avatar

Try the latest beta build, we've done some changes.

http://download.devolutions.net/Devolutions.RemoteDesktopManager.Bin.8.0.24.0.zip

For some (not yet fully understood reason) it doesn't work on my development machine but works on every other dev/test machine we've tested on. That includes Windows 7, Windows 8 & Windows Server 2012 OS.

Stéfane Lavergne

avatar

Hi Team,
while trying to import PSModule for RDM getting below error:

PS C:\Users\dl-dvls-svc> Import-Module “${env:ProgramFiles(x86)}\Devolutions\Remote Desktop Manager\RemoteDesktopManager
.PowerShellModule.dll”
Import-Module : The specified module 'C:\Program Files (x86)\Devolutions\Remote Desktop
Manager\RemoteDesktopManager.PowerShellModule.dll' was not loaded because no valid module file was found in any module
directory.
At line:1 char:1
+ Import-Module “${env:ProgramFiles(x86)}\Devolutions\Remote Desktop Manager\Remot ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ResourceUnavailable: (C:\Program File...ShellModule.dll:String) [Import-Module], FileNot
FoundException
+ FullyQualifiedErrorId : Modules_ModuleNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand