OpenSCManager API failed with AccessDenied for Remote Computer

Navaneeth R 21 Reputation points
2021-09-07T08:10:41.31+00:00

Hi,
While trying to establish a connection to the Service Control Manager on Remote Computer using OpenSCManagerA( ), it's failed with Access Denied.

This API succeeds when I execute this command with user session. When I run this command with SYSTEM session, it fails.

https://learn.microsoft.com/en-us/windows/win32/api/winsvc/nf-winsvc-openscmanagera
In the above document, the following is mentioned
"To connect to a service remotely, call the LogonUser function with LOGON32_LOGON_NEW_CREDENTIALS and then call ImpersonateLoggedOnUser before calling OpenSCManager."

As mentioned above, I tried impersonating as Domain Admin with LOGON32_LOGON_NEW_CREDENTIALS before calling OpenSCManagerA( ) API. But still it is failed with Access denied error.

Tried enabling and disabling UAC on Remote computer, uninstalled Anti Virus on source machine and remote machine, no software restriction policy configured.
But still no luck.

This issue occurs only on Windows 10 machines!

Is there anyway to execute OpenSCManager API in SYSTEM session? Could anyone help me?

Thanks and Regards,
Navaneeth R

Windows API - Win32
Windows API - Win32
A core set of Windows application programming interfaces (APIs) for desktop and server applications. Previously known as Win32 API.
2,471 questions
C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,591 questions
{count} votes