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

Refactor logged_on_user_sid to support Windows Server 2019 #276

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

danhutchings
Copy link

@danhutchings danhutchings commented May 26, 2022

In its current state, CPE::Helpers.logged_on_user_sid returns nil on Windows Server 2019 because CPE::Helpers.logged_on_user_sid is searching for a registry value LastLoggedOnUserSID in CPE::Helpers.logged_on_user_registry that doesn't exist in that version of the operating system. To fix this, the code is being refactored to use PowerShell command to retrieve the SID of the current logged in user. This code also works with earlier versions of Windows Server and Windows 10 endpoints.

What type of PR is this?
/kind bug

What this PR does / why we need it:
Without this, Windows Server 2019 will return nil for CPE::Helpers.logged_on_user_sid

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:
This will require a Windows Server 2019 host to test on

Does this PR introduce a user-facing change?:

NONE

Additional documentation e.g., Design Proposals, usage docs, etc.:


In its current state, the  returns  on Windows Server 2019 because the  is searching for a registry value that doesn't exist in that version of the operating system. To fix this, the code is being refactored to use PowerShell command to retrieve the SID of the current logged in user.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants