<PackageReference Include="Microsoft.Win32.SystemEvents" Version="10.0.0-preview.4.25258.110" />

SessionSwitchReason

public enum SessionSwitchReason
Defines identifiers used to represent the type of a session switch event.
namespace Microsoft.Win32 { public enum SessionSwitchReason { ConsoleConnect = 1, ConsoleDisconnect, RemoteConnect, RemoteDisconnect, SessionLogon, SessionLogoff, SessionLock, SessionUnlock, SessionRemoteControl } }