Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Programatically Add New Connections
#1
In the 2012 version we could add new connections to the database easily.

In 2017 ASG-RemoteDesktop I see the schema change is different and looks encrypted.

I am looking at a way to add new connections via our provisioning process.  Is there a stored procedure we can pass in the connection info, or another way.

Please advise.
gb
Reply
#2
You should look at the PowerShell-API - there you have programmatically access to all objects in the database
Regards/Gruss
Oliver
Reply
#3
Looking through and was able to get module loaded. But Connect-RDEnvironment fails.

Any suggestions?

Connect-RDEnvironment : Object reference not set to an instance of an object.
At line:1 char:1
+ Connect-RDEnvironment -Environment "Dev" -PassThrough
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (Smile [Connect-RDEnvironment], NullReferenceException
+ FullyQualifiedErrorId : System.NullReferenceException,CloudAdminPSModule.CmdLetEnvironment+RDBaseItemChildsGetCo
mmand
Reply
#4
Did you set the working dir correctly? It is explained in online help file - just try the following script

$workingdir = "Program Files (x86)\ASG-Remote Desktop 2018\"

Set-Location $workingdir
[Environment]::CurrentDirectory = Get-Location -PSProvider FileSystem

$path = $workingdir + "ASGRD-PSAPI.dll"

Add-Type -path $path
[reflection.assembly]::LoadFrom($path) | Import-Module

Connect-RDEnvironment -Environment Dev -PassThrough
Regards/Gruss
Oliver
Reply
#5
(07-02-2018, 03:30 PM)DevOma Wrote: Did you set the working dir correctly? It is explained in online help file - just try the following script

$workingdir = "Program Files (x86)\ASG-Remote Desktop 2018\"

Set-Location $workingdir
[Environment]::CurrentDirectory = Get-Location -PSProvider FileSystem

$path = $workingdir + "ASGRD-PSAPI.dll"

Add-Type -path $path
[reflection.assembly]::LoadFrom($path) | Import-Module

Connect-RDEnvironment -Environment Dev -PassThrough
This does not work as you can see the error in the previous thread.
Reply
#6
Did you try without quotation marks? Only DEV as parameter
Regards/Gruss
Oliver
Reply
#7
(08-02-2018, 12:00 PM)DevOma Wrote: Did you try without quotation marks? Only DEV as parameter

I tried with both and get the same output.

Is there anything else you can suggest?
Reply
#8
I tried on a test machine and run into the same issue - I will check that and return asap
Regards/Gruss
Oliver
Reply
#9
Ok, I was on the wrong machine and had the environment I tried to open not in the environment list - as I get the same error as you - Can you check that your environment "DEV" is in the list of Environments when you open Environment Manager in ASG-RD?

You also should check that you run the correct Powershell version - if you have ASGRD installed as 32bit app you need to start the x86 powershell - and of course if you installed x64 you can use Powershell (x64)!
Regards/Gruss
Oliver
Reply
#10
(08-02-2018, 04:05 PM)DevOma Wrote: Ok, I was on the wrong machine and had the environment I tried to open not in the environment list - as I get the same error as you - Can you check that your environment "DEV" is in the list of Environments when you open Environment Manager in ASG-RD?

You also should check that you run the correct Powershell version - if you have ASGRD installed as 32bit app you need to start the x86 powershell - and of course if you installed x64 you can use Powershell (x64)!

I think I did what you suggested and still have error.  I found ASG had a PowerShell console that loads the API.


Attached Files Thumbnail(s)
   
Reply
#11
Sorry but in screenshot it looks like you typed / instead of l - many users are using Powershell API - so it can't be that the first command is not working
Regards/Gruss
Oliver
Reply
#12
You also should be able to connect to a file base environment - just create one (name Standard) and try again - it should really work
Regards/Gruss
Oliver
Reply
#13
OMG you are so right. They used an "/" in the environment name. That is so stupid. The command runs now.

Now to figure out how to get a new connection added.
Reply
#14
Ok :-) Great - let me know if you have some more questions :-)
Regards/Gruss
Oliver
Reply




Users browsing this thread: 1 Guest(s)