Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Remote Powershell connect
how can i build an external application to connect to a remote Windows Server via powershell?

with the powershell command:

Enter-PSSession -computername servername -credential domain\user  you can connect to a remote server

In external Application I try :
Dateiname: C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe

Argumente: Enter-PSSession -Computername %computername% -credential domain\user

and no option

When i Connect to a server i can type my Credentials but then the Powershell windows Closed

Thank you for your help
That's nothing that is related to ASG-RD
(11-05-2017, 11:23 AM)DevOma Wrote: That's nothing that is related to ASG-RD

Ok.... but that is not really helpful. Thank you for nothing!

So it is not possible to build an external application to connect remotly to a windows server with powershell?

Sad That is poor!

We use ASG-RD serveral years and now more and more Windowsserver run without a gui so the main admin tool goes to powershell. But a naked Powershell is not so comfortable like ASG-RD.

Have you another idea to connect remotly via powershell ?

How do other users here connect to their Servers without a gui?

With best regards Bjoern Schmidt
I never tried to connect a RDP session via Powershell and so I don't know :-) But if you google for "Powershell connect RDP session" you find a lot of results that may help you.
(11-05-2017, 12:34 PM)DevOma Wrote: I never tried to connect a RDP session via Powershell and so I don't know :-) But if you google for "Powershell connect RDP session" you find a lot of results that may help you.

that is not the point. I dont want to connect via rd protocol. I want to connect with powershell like you connect a ssl connection via putty. And this connection should be clickable over ASG-RD. Please look at my screenshots.

powershell1.png  I start my powershell and connect to a server called bremen with domain\user
powershell2.png now i am connected on a remote powershell on server bremen (i can now act as if i am on the server )
powershell3.png  with exit i can disconnect the powershell session to bremen
externalapp.png this is what i tried to do

when i now start the external application the powershell windows comes up and i can sign in but after the sign in the powershell windod closed immediately

Thank you for your help

if you like we can switch to German

Attached Files
.png   powershell1.png (Size: 32.56 KB / Downloads: 10)
.png   powershell2.png (Size: 10.49 KB / Downloads: 8)
.png   powershell3.png (Size: 18.77 KB / Downloads: 9)
.png   externalapp.png (Size: 35.99 KB / Downloads: 13)
Ok I understand now :-)

Arguments: -noexit "enter-pssession -computername %computername%"

Try that - it's working for me :-) You can also integrate as Tab.
(12-05-2017, 09:45 AM)DevOma Wrote: Ok I understand now :-)

Arguments: -noexit "enter-pssession -computername %computername%"

Try that - it's working for me :-) You can also integrate as Tab.

Perfekt! Big Grin
and the Argument for TAB integration is ?

Thank you
That's an option in Ext. App. properties
This is a nice addon.. Would be great to have a separate forum for Addon Ideas.
Sorry , I did not get how to add this as a tab. also is it possible to provide the name of the server as a parameter value ?
I saw taht teh options all three need to be set . I increzsed the timeout to 3600 seocnds so that i will ahve one hour the tab will be open .

option 1 : wait for exit
option 2 : try to integrate
Option 3 : Stat as a shell process.
Check all these 3 options .
I'm testing this now with 10.1.5630.1 and it doesn't seem to be doing variable substitution.

I have tried:
-noexit enter-pssession -computername %NAME%
-noexit "enter-pssession -computername %NAME%"
-noexit enter-pssession -computername %COMPUTERNAME%
-noexit "enter-pssession -computername %COMPUTERNAME%"

In all cases, when the shell starts, I get the message:
Enter-PSSession : Missing an argument for parameter 'ComputerName'. Specify a parameter of type 'System.String' and
try again.
At line:1 char:17
+ enter-pssession -computername
+ ~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (Smile [Enter-PSSession], ParameterBindingException
+ FullyQualifiedErrorId : MissingArgument,Microsoft.PowerShell.Commands.EnterPSSessionCommand

The connection history log shows
Enter-PSSession Start ExtApp C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -noexit "enter-pssession -computername"

The weird thing is that an RDP connection ext app, which I had defined months ago as:
file name: c:\windows\system32\mstsc.exe
arguments: /v:%NAME%

expands the variable just fine.

I tried copying/cloning both of these and have managed to break it now - I'm wondering if perhaps creating a new object results in one that won't resolve variables?
For testing you should create a simple "notepad" ext. app. - just set "notepad.exe" as filename and arguments "%Computername%" - right click on a connection and choose "Ext. App.=>notepad" - notepad should try to open a text file with the name of your computer - the variable is working in all my environments
Ok, I just tried your test. Created a new app called notepad.

Notepad.exe as file. %Computername% as argument.
On a test connection object, add ext app as a role, configure the ext app to be notepad.
Right click the test object, connect with protocols, ext app. Notepad fires up with no prompt. The log shows destination as notepad.exe

Edit the notepad ext app, substitute test.txt in to the argument field. Test again, and it asks if I want to create a file named test.txt
The log shows destination as notepad.exe test.txt

So it's definitely not pulling the variables - why it's not the same as yours, I don't know!

The other variable handling you added in the program field still works fine.
If you already configured your connection to use "Ext App" as protocol you do not need to start the connection via "Connect with Protocols" - you can just double click to connect - and then it should work - or you should use "Ext.App" context menu and choose your - then it should also work!

Users browsing this thread: 1 Guest(s)