Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Powershell API
#1
Hello,
I have been trying to test out the new Powershell API but am unable to establish a connection to my SQL database.

Can someone please help me figure out how to setup the Connect-RDEnvironment function for an msSQL database on separate server?

My best guess that sadly doesn't work was
Connect-RDEnvironment -Environment "Data Source=[servername];Initial Catalog=[databasename];Integrated Security=True"
but it just give me error
"Connect-RDEnvironment : Object reference not set to an instance of an object."

Much appreciate any help I can get!
/Erik
Reply
#2
The Powershell-API is completely described in the help - every single command with all parameters and examples how to use...

After parameter "Environment" you need to specify the name given within ASGRD for your environment you want to connect to - the connection string is read from your configuration like it is when you start ASG-RD in UI mode
Regards/Gruss
Oliver
Reply
#3
I have tried Connect-RDEnvironment -Environment SDO_NE_ASGRD -PassThrough
and all other ways I can think of but it gives the same error and I have read the help but sadly it doesn't help me to figure this one out.

If environment is supposed to be the name used inside ASGRD then I assume my issue is with how the API finds the environment list and from what I can figure out the environments used to be stored in appdata in version 8 but now it seems to be stored here C:\ProgramData\ASG-RemoteDesktop\9.0\environments.xml
Could that be any hints for my issue?

BR
Erik
Reply
#4
Yes it should read from C:\ProgramData\ASG-RemoteDesktop\9.0\environments.xml

Did you use the shortcut to start the API? Because you need to use the 32bit Powershell app - it should be started if you use the shortcut from start menu...

I will check the code what else could be a problem...
Regards/Gruss
Oliver
Reply
#5
Have tried it both with the default ASG-RD Powershell shortcut and with PowerGui in x86 loading
[reflection.assembly]::loadFrom( 'C:\Program Files (x86)\ASG-Remote Desktop 2016\ASGRD-PSAPI.dll' ) | Import-Module

I'm running windows 10 with PSVersion 5.0.10586.122 if that helps.
Reply
#6
Is your current directory the folder of ASGRD? When using shortcut it should be - if you are running Powershell without shortcut you need to switch to the program files directory of ASGRD2016...

Only to be sure - you can start ASGRD 2016 without any problems and using the environment you also want to connect via Powershell?
Regards/Gruss
Oliver
Reply
#7
I found the issue, seems like it doesn't work when running powershell in elevated mode as I need to do since we use separate windows account for admin tasks.
Think I should be able to work around it for now but would be great if it was possible to solve somehow.

BR
Erik
Reply
#8
Ok, I will check that and try to solve...
Regards/Gruss
Oliver
Reply
#9
(27-04-2016, 09:26 AM)DevOma Wrote: The Powershell-API is completely described in the help - every single command with all parameters and examples how to use...

After parameter "Environment" you need to specify the name given within ASGRD for your environment you want to connect to - the connection string is read from your configuration like it is when you start ASG-RD in UI mode

Where can I find the "Help"?
Reply
#10
Hi,

just press "F1" inside of the program ;-) Or from the main menubar at the top press "?" and the the forst item is "Help".

Best regards,
Michael
best regards,
Michael -- michael.scholz@asg.com --
Reply




Users browsing this thread: 1 Guest(s)