Check if someone is using a remote desktop connection to a computer - c#-3.0

I want to check whether a computer is being used by a remote desktop connection from another computer or not.Is there anyway to do it in C#.

WTSEnumerateSessions is the Win32 API to use.
Once you've found the right P/Invoke signature for calling it, you can look at the names of the windows stations returned

Related

Connect to iDrac Virtual Console programmatically

I frequently connect to the virtual console provided by iDrac on many Dell servers which I manage. I'm looking for a way to connect to the virtual console programmatically, or whatever method that's faster than logging into the web interface manually and going through all the prompts.
Dell's racadm tool does not support this, apparently. iDrac is not set up with domain auth, just using a local account configured on iDrac. I would be connecting from a Windows machine, any browser.
Is there any way to automate this? Even partially?
I use a shell script for this, you can make a .bat file on Windows. See some simple instructions to start iDrac console from command line here

How do I connect to a SQL Server which is usually a machine I remote desktop into

Typically I remote into a machine with IP Address 00.00.00.00 and then I have an account in a domain, let's call it myspecialaccount\firstname.lastname.
Then I use Windows auth to connect to SQL Server instance for example:
ABCLACSQLC123\DEV04A
So my question is HOW can I connect from my laptop through SSMS directly to the machine (pending ports are open etc..)
In order to use Windows Authentication, you'd have to add the credentials you use to login to the laptop as a "Login" to the SQL Server. That can only be done if
You login to your laptop with a domain user and
The user is in the same domain in which your SQL Server instance resides
Otherwise, you have no choice but to use SQL Server Authentication.
In this case, you login to your laptop with a user in "Corp" domain, but SQL Server instance is in "Services" domain. So it won't work. Unless I think both domains are part of the same Forest.
Look at this answer : https://stackoverflow.com/a/1615431/3317709. There is no trick to login, unless you get rid of the "Network related..." error. If you are getting this error, SSMS is not even able to find your server let alone logging into it. Once you get "Login failed..." error, from that point, we can tinker and try to get thru using your windows auth.
Try creating a shortcut to runas.exe, pointing to SSMS.
C:\Windows\System32\runas.exe /netonly /user:myspecialaccount\firstname.lastname "C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\Ssms.exe"
(The path to your SSMS exe may vary.)
When you double-click the shortcut, this will open up SSMS. You should then be able to connect to your instance (ABCLACSQLC123\DEV04A) as if it were on your local machine.
See here for more info on the runas command: https://technet.microsoft.com/en-us/library/cc771525.aspx
Install SQL Server Management Studio Express on your laptop. Microsoft has made the download link obscenely hard to find on their own site, but I did manage to find it here. Download the one for your system, probably x64.
Installation isn't much easier. Once everything is extracted, run the program, and switch to the installation tab, and choose "Standalone installation or add new features". Continue along the installation, and just install the management tools.
Once installed and running, use the Connect to Server dialog (it should open when you start the program, but if it doesn't, it's the first option under the File tab), and target wherever you want to connect (IP or server name should both work). If your laptop also authenticates to the same server that handles Windows authentication for your database, you can use Windows authentication, otherwise, you'll have to create a SQL Server account to use for login.

how to connect to Socket from vbscript

I want to connect to a java server socket threw ASP Classic. For this when I google then found winsock.dll but it does not work. I try below code to create object
Dim x
Set x = CreateObject("MSWINSOCK.Winsock.1")
but error comes cant create object . So can any body tell me how can I connect to a socket at a specific port threw vbscript. Is there any other com object provided by microsoft so that we can trust on that and use that.
The MSWINSOCK component is not provided by winsock.dll, it is provided by MSWinsck.ocx.
You can check it is registered by looking in RegEdit.exe under HKEY_CLASSES_ROOT\MSWinsock.Winsock.
This control is 32-bit only, so it will only work when running scripts with the 32-bit hosts.
I suspect you either don't have it installed, or are running your script under 64 bit operating system.
If the latter, you should launch your scripts from the 32bit hosts like so:
c:\windows\syswow64\cscript.exe //nologo c:\path\to\script.wsf /argument:value
or:
c:\windows\syswow64\wscript.exe //nologo c:\path\to\script.wsf /argument:value
But really I would suggest you should not be attempting general network communications application from VBScript. Try VB.Net instead.

Testing AppServer/Database Availability Remotely in Progress 4GL

We have Progress appservers (OE 10.0B05) running on AIX UNIX and I want write some code to check if they are up and running. The code to check the appserver would be run from a WIN2008 server. I can pull up Progress Explorer on the WIN2008 server to check the status of the appservers, but I need to write some code that can check their status programatically.
Is there any way to programatically check whether my AIX UNIX Progress appserver is up and running from a remote WIN2008 server?
To get app server status information you can use "asbman".
To get it remotely you would need some means to invoke a remote process and return a value. I'm a unix guy so I usually use "ssh" for that sort of thing.
There are Windows versions of SSH (look at the PuTTY suite for a really good free option). If you set it up to use pre-shared keys or an "agent" there are no messy login prompts to get in the way. Something like (untested):
plink -i sshkey.ppk user#server.name "asbman -name appServer -query"
"asbman" also supports -host and -port parameters if you happen to have it running on the windows box that you want to make the inquiry from.
If you have a small program that can open a socket connection, that would do it. If the program can open a socket, you can be reasonably confident the appserver is running.
You -might- be able to use the ABL SOCKET functionality to do this. Failing that, any other program which can open a socket on a remote machine and then close it will work.b

Error 1219. Multiple connections to a server or shared resource by the same user

I am trying to map network drive, but get error 1219 on Windows XP:
net use z: \\serverA\tests password /user:serverA\alex
I have tried
net use * /del /yes
But it has no effect, and the
net use
shows empty list.
\\serverA\tests is a valid path, as I can open it in Explorer.
What can be done?
EDIT: After reboot it works. But any ideas are still very welcome.
This will usually be caused by a handle left open. Download Process Explorer to find it, and try to close the program that has it open (don't close the handle itself). If it turns out to be explorer.exe, it's probably a buggy preview handler/shell extension.
If you can't find the handle, you can always try using the IP address of ServerA to create a new connection with different credentials, e.g.
net use z: \\10.1.2.3\tests password /user:serverA\alex
Yes, sorry - use Find Handle or DLL with \\ServerA to find the program.
To open it in Explorer it has to be able to logon using your credentials (or the ones you provide when it eventually asks you for credentials).
After that you have a connection and would have to disconnect before you could remap the share with different credentials. (see "Disconnect network share")
You could map it persistently - that way it would always use the credentials you provide.