Page 1 of 1

[SOLVED] Registry key modification/computer description

Published: October 15, 2020 - 11:31
by mviale
Good morning,

I am trying to modify the registry key corresponding to the computer description, located in HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\LanmanServer\Parameters
To do this, I need to retrieve the user logged in at time T, then retrieve information from the active directory.

My problem is retrieving the logged-in user using get_current_user:
  • My initial idea is to retrieve the information using the `def install()` function: it assumes the logged-in user is System, which seems logical
  • One workaround is to use session_setup; I can retrieve the logged-in user and all the Active Directory information, but I can't write the registry key because a non-administrator user doesn't have the necessary rights
Is there a trick to retrieve the logged-in user in the def install() function?
Or is there another solution I haven't thought of?

Mathieu

Re: Registry key modification/computer description

Published: October 21, 2020 - 2:43 PM
by mviale
I found a solution!
I finally retrieved the value of the key HKEY_LOCAL_MACHINE,'SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI\LastLoggedOnUser', which allowed me to retrieve my username using def install().

Mathieu