Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding "use_system_account" to work with GMSA accounts #574

Open
IgorNik13 opened this issue Jul 29, 2024 · 1 comment
Open

adding "use_system_account" to work with GMSA accounts #574

IgorNik13 opened this issue Jul 29, 2024 · 1 comment

Comments

@IgorNik13
Copy link

IgorNik13 commented Jul 29, 2024

Can you add a new use_system_account parameter and new rules to run a special account on a remote windows machine?

if process_username is not None and process_username.lower() == "system":

from pypsexec.client import Client

host = "win-host.domain1.lco"
user = "[email protected]"
passw = "SecretPassword"
username_gmsa = "GMSA_LOGIN$"
working_directory = "C:\\"
c = Client(host, username=user, password=passw)
command = "echo Hello World"

c.connect()
try:
    c.create_service()
    stdout, stderr, rc = c.run_executable("cmd.exe",
                                          arguments="/c " + command, username=username_gmsa, use_system_account=True, working_dir=working_directory)
finally:
    c.remove_service()
    c.disconnect() ```


    process_username = module.params['process_username']
    process_password = module.params['process_password']
    use_system_account = module.params.get('use_system_account', False) # or something more appropriate
    use_system = False
    if process_username is not None and use_system_account == True:
        use_system = True # this works for me when I use special GMSA accounts to run commands on windows using cmd or powershell
        process_username = process_username  ##
        process_password = None
@jborean93
Copy link
Collaborator

The underlying Python library used by the psexec module uses the PAExec executable on the service side which does not support gMSA accounts the last time I checked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants