WTSOpenServer returns "access denied" - winapi

I'm trying to use the Remote Desktop API on a remote machine that I have Administrator rights on, however the WTSOpenServer call always returns error 5 ("Access denied"). I even tried calling WNetAddConnection2 to establish a session, which works fine (I can connect to IPC$ or C$) on the machine). I can also use the Remote Desktop client to actually start a terminal session to it.
The remote machine is running Windows XP Pro SP3 and I'm running Windows XP Pro x64 SP2.

Check the value of HKLM\System\CurrentControlSet\Control\TerminalServer\AllowRemoteRPC, it is set to 0 by default on workstation OS and needs to be set to 1 for WTSOpenServer to work.

Related

How to get Remote User Credentials in TwinCAT XAE of Target System?

How can I get the password for the Remote User Credentials in TwinCAT XAE.
Context:
I have TwinCAT XAE in development PC-Windows and I have TwinCAT XAR on another PC-WINDOWS which is my Runtime PC. I want to connect both these PCs via Ethernet/IP to shift my code from development PC to my Runtime PC.
I have done the TCP and UDP settings for the runtime PC already.
The Development PC is detecting the run time PC in the select target/System window. But, I am un able to connect them because I don't know the password of the remote user for the remote user credentials window. I have tried the password of the runtime PC (which a PC asks when it starts) and also the default value 1, as mentioned in some of the online videosenter image description here
You need to enter the credentials for an administrator account on the PC. The default username/password of "Administrator/1" only applies to factory default Beckhoff PLCs, and not your Windows PC that you have created yourself. To solve this issue, simply create an account called "Administrator" on the Windows 10 PC running the XAR and set a password of 1.

Windows xp remote shutdown

I m a computer teacher in computer lab. I have approxly 30 pc in lab.
I want to enable remote shutdown in all pc.
I have all pc's admin rights. There are no domain in lab.
So I write all pc ip's in one text file.
I used "shutdown -i" command and copy all the ip's and paste it to windows.
But some pc not showdown and some properly shoutdown.
There are access denied error display for some pc shutdown.
My question is I want to make one universal .reg file, that I want to run in every pc and enable remote shutdown in every pc.
Every pc run Windows xp sp3.
There are no registry settings that you can tweak in order to enable remote shutdown.
You just need to provide the correct set of login credentials with the command. But as there is no possibility to send a username and password with this command, you have to do a little trick:
Connect a network share from the remote computer using an user account from the remote PC (also IPC$ works). By doing so, you have authenticated to this PC for further operations. After that, you can send the shutdown command.
I am using it successfully in the exactly same way as described here in a C# program.

Remote debugging error unable to connect and the remote computer is not responding?

I have been messing with remote debugging so finally out of despair here I am. I am trying to connect to a Win 2003 remote machine where I have remote debugging installed (NO VS installed on this machine.) following this tutorial. So, I have added all the ports to exceptions in the firewall and I am trying to connect from my visual studio 2010 (run as administrator) and windows 7 Home Premium local machine using No authentication method by attaching it to a process. (For some reason I cannot use windows authentication and gives me edition not supported error!)
What happens is on the debug monitor it says that User has connected but then it just sits there waiting and finally gives an error Unable to connect to xxx.xxx.xxx.xxx. The remote machine is not responding. I tried to research a lot and also created a user with the same name as on the local machine on the remote machine. Also I used telnet as mentioned in the link and it does not show connected to the remote system message but does not show that it failed either and just sits there. I am guessing it something to do with the port not open correctly.Also after the first connection attempt when I try to connect again the remote debug monitor does not show any connected message and also the error I get is that remote debug monitor is not setup or running on the machine (almost like the debugger stops reponding). I am pretty exhausted trying out all the options can anyone give me more direction here ? Thanks !

DeleteIpForwardEntry Access Denied on Vista

Calling DeleteIpForwardEntry() works perfectly well on Windows XP and Windows 7. On Windows Vista, however, it fails with ERROR_ACCESS_DENIED.
The documentation says that "the user lacks the required administrative privileges on the local computer or the application is not running in an enhanced shell as the built-in Administrator (RunAs administrator)."
Well, in my case the user is the Administrator on the local computer and the application is run on logon via SOFTWARE\Microsoft\Windows\CurrentVersion\Run so I can't really tell it to run in an "enhanced shell".
Is there a way to solve this "Catch 22" situation in Vista?
I don't understand why this would work on Windows 7. The docs indicate the failure will be the same.
On Windows Vista and later, the
DeleteIpForwardEntry function can only
be called by a user logged on as a
member of the Administrators group. If
DeleteIpForwardEntry is called by a
user that is not a member of the
Administrators group, the function
call will fail and ERROR_ACCESS_DENIED
is returned.
Also, your post indicates the logged on user is an Administrator. Is it possible that your Windows 7 and Windows Vista tests are for different users - on Windows 7 your test user is an admin, on Windows Vista machine the test user is not?
There's no way to work around this running the app in that way. Can you re-implement this as a Windows Service running in an admin account, which acts on interactive logon events on the machine to manipulate the IP configuration as needed?

Windows Server 2003 - Share current Desktop via RDP like in Windows XP?

Unfortunately I have to use Windows Server 2003 on my 32 bit workstation due to memory constraints of Windows XP.
In Windows XP, when you connect via Remote Desktop the current session I am logged in is instantly shared on the Remote Desktop. I can see all the applications I have opened on my workstation and can continue to work on my open applications.
On Windows 2003 Server however, each Remote Desktop connection gets a new session. With no applications opened. So I have to use the Task Manager and connect to my existing session manually to see the opened applications.
Can this be changed so that Windows 2003 Servers acts exactly as Windows XP? I do not need to allow multiple users to connect to the box simultaneously. I would even like to prevent that, since it is used as a workstation and do not want to allow other domain users to start applications on my workstation.
Logon to any session on Windows 2003 server. Goto Administrative tools-->Terminal services configuration-->Server Settings-->Restrict each user to one session(check this box)
login again using RDP & you are good to go.
The secret is to start Windows Terminal server client with the /console command so:
mstsc.exe /console
This will connect you to the existing cosole session rather than connecting you to a new session.
XP does this by default as it only supports a single (console) session. Windows Server support multiple sessions (depending on version and licensing) hence you need to specify /console when you want to connect to the existing console session.
You can run MSTSC /admin or MSTSC /console depending on what version you have installed which will then connect to the console sessions
mstsc.exe /admin

Resources