IT-CPE icon indicating copy to clipboard operation
IT-CPE copied to clipboard

Refactor logged_on_user_sid to support Windows Server 2019

Open danhutchings opened this issue 2 years ago • 0 comments

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.:


danhutchings avatar May 26 '22 01:05 danhutchings