Enumerate logon sessions remotely - c

I want to enumerate logon sessions on a remote host (citrix terminal server). What I found so far is LsaEnumerateLogonSessions() / LsaGetLogonSessionData(), but you can't call it remotely.
I read some docs about RPC, but if I understood it right, you need an extra application on the remote host that executes your functions (that's something I want to avoid).
Is there a way to implement such a thing? Maybe with the remote desktop api?
Another solution I found: http://msdn.microsoft.com/en-us/library/windows/desktop/aa370669%28v=vs.85%29.aspx

Other options include the WTS APIs: WTSEnumerateSessionsEx. If you want to be Citrix specific you can also use the XenApp PowerShell SDK.

Use Win32_LogonSession, it is possible to call WMI from a remote computer.

Related

How to transfer a file from Windows XP to a virtual machine inside vSphere 5.5?

I have a file on my desktop that I need to put onto one of the virtual machines, however when I search for solutions on how to do this many say to download third party software to do it, or to use drag and drop through vSphere. The issue is I am on a restricted network and can't install additional software, and also don't have the drag an drop functionality in vSphere.
I have seen it done in the past using the command line and the IP address of the machine I want to send it to, along with the username and password, however I can't remember the syntax. Can anyone provide instruction on what to type into the terminal to do this?
Have you given the Copy-VMGuestFile cmdlet a look from PowerCLI?
http://www.vmware.com/support/developer/PowerCLI/PowerCLI651/html/Copy-VMGuestFile.html
If you're not a fan of PowerShell, there's a couple SDK options you could use with the vSphere Web Services API. Specifically, you're looking for the GuestFileManager object and the InitiateFileTransferToGuest method: http://pubs.vmware.com/vsphere-5-5/topic/com.vmware.wssdk.apiref.doc/vim.vm.guest.FileManager.html

Remote Desktop Application - Start multiple sessions on my client PC

I have a windows 2016 server running RDS. It is configured to run a single application when a user accesses it from a .rdp shortcut. The user just sees the application as though it is running on their local machine, not a whole remote desktop.
If from a client PC, if I launch the application and log in then I can see a new connection in the RD Gateway manager.
However if I launch the application from the same client PC multiple times I am only asked to login the first time, and whilst I see many instances of the application I only see one connection in the RD gateway manager.
I would like a new connection each time I launch the application, so that I can simulate multiple users running the app concurrently in their own sessions.
I have tried adding "prompt for credentials on client:i:1" to the .rdp shortcut and this has no effect.
Thanks you your help.
I don't think it's possible. Let me try to explain:
Whenever you launch the RDP file, you connect to a session on the RDSH. Now, if you want separate connections, that means that there should be multiple sessions (probably for the same user since the credentials don't change) which is not allowed by the RDSH by default.
Assuming you get passed multiple sessions for same user, MSTSC actually recognizes that for the given RDP file, there is already an open connection, so it will try to reuse that.
Last but not least, there is the problem of licensing - you are "working around" the system: both per-device and per-user licensing would report 1, therefore it would probably be a violation of ToS.
It would be much more useful if you could tell us what you are trying to achieve and then maybe we can help you more.
P.S.: This question has nothing to do with programming, so it probably belongs to https://superuser.com
Hi I figured out a solution to this, so I will share in case it is useful for anyone else.
Modify the hosts file to include different names for the target machine ip address:
eg:
51.xxx.159.233 test1.xxx.uk-user1
51.xxx.159.233 test1.xxx.uk-user2
51.xxx.159.233 test1.xxx.uk-user3
51.xxx.159.233 test1.xxx.uk-user4
Then in each rdp launch shortcut, reference a different alias.
eg:
Shortcut1:
full address:s:test1.xxx.uk-user4
Shortcut2:
full address:s:test1.xxx.uk-user3
Then when the RDP is launched it will ask you to log in even if you already have an active connection and server will have a new user logged into it.
Hope this helps somone in the future.

How to use ansible api(by python) to get Windows host info?

I know how to use ansible to connect to Windows hosts. And I also can get some info by setup module. But now I want to get info through the ansible api. It's not hard to do this if the host is a Linux system, but I don't know how to do that if the host is a Windows system.
ok,I know how to do that.There is a option named connection,this option's default value is 'ssh',you can change it to 'winrm',then you can use the api to manage windows host

Downloading a file from SFTP Server in Delphi [duplicate]

I'm writing a simple Delphi App to upload a few files to a SFTP Server. i thought i would be able to use a TIdFTP indy client but it seams as tho their is not an option for FTP Over SSH (SFTP) does anyone know of any Free / Open source Components for Delphi 2010 that would support FTP over SSH (SFTP). Due to security reasons im unable to use Active X controls so please do not respond with Active X solutions.
Thanks for the help,
Kyle
SFTP and "FTP over SSH" are two separate things, and neither involves SSL (as someone else has suggested). SFTP is a sub-protocol of SSH while "FTP over SSH" is good/bad ol' FTP tunnelled through an SSH connection with port forwarding.
Either way, what you're after is a Delphi SSH library. I was unable to find a free SSH library for Delphi and ended purchasing SecureBlackbox (http://www.eldos.com/), which is excellent by the way, although SecureBridge (http://www.devart.com) also looks pretty good.
1) SFTP is NOT FTP-over-SSH. Read the discussion here.
2) For SFTP there are no free Delphi components. You can use our SFTP client and server components for Delphi (part of SecureBlackbox product), which are supported and maintained commercial solution.
I've been using PuTTY's SCP command line utility, with catching it's standard out via the CreateProcess method.
IP*Works include SFTP component - http://www.nsoftware.com/products/component/sftp.aspx and registered user of Delphi XE a XE2 can download this from code central (ID: 28437, ID: 28012)
and for Synapse is in contrib dir demo of simple SFTP - http://synapse.ararat.cz/files/contrib/
And since October 2019, there's a DLL fork of PuTTY with Delphi units, please see
https://github.com/superflexible/TGPuttyLib
This was created to be able to achieve the highest possible transfer rates over SFTP. It's free and very easy to use (with examples).
Look at Synapse ( http://synapse.ararat.cz/doku.php/download ) suporting ssl protocole.
Exemple code: http://synapse.ararat.cz/doku.php/public:howto:tcpwithssl
Another secure connection component set is from nSoftware: http://www.nsoftware.com/ipworks/ssh/components.aspx
You get SSH Tunnel, and SFTP.
They also offer a full component set of SSL related items: http://www.nsoftware.com/ipworks/ssl/components.aspx
libssh2 (wriiten in C) supports SFTP, and we have two separate Delphi wrappers (not sure which one is better):
https://github.com/pult/libssh2_delphi
and
https://github.com/dimmaq/delphi-libssh2
SecureBridge from DevArt also support SFTP, comes with full source for the Professional Editon.

Hosting Multiple Domains on Same Server Port with Apache2

How do I configure Apache2 via webmin or command-line (I'm using RHEL5 Linux) so that I can have multiple domains on the same server on the same port but in different subdirectories?
For instance, trying to get homerentals.ws and homerepair.ws to be detected on port 80 (default port) on the same server. I know that my DNS holds the two addresses and web hits currently go to the same test page. Now all I need is for web hits to go to a subdirectory, but not show this subdirectory. For instance, I do not want people going to http://homerentals.ws and being redirected back to http://homerentals.ws/homerentals/. Instead, http://homerentals.ws would go to /var/www/html/homerentals, while http://homerepair.ws would go to var/www/html/homerepair, but would not look any differently in the URL.
On IIS, I did this once with host-header detection. But I don't know how to do it on RHEL5 Linux via webmin or file editing. I'm stuck.
The feature you're describing is known as virtual hosts. Have a look at Apache's documentation. In general you need to edit /etc/apache2/httpd.conf file to make things happen (maybe it can be edited through webmin, but I'm not familiar with it).

Resources