The focus of this forum is on developing integrations to work with Milestone XProtect. When you are not logged in XProtect cannot help you and there are no methods in the MIP SDK for this.
I have an idea you might find answers that will allow you to get the information from Windows directly if you search other forums but this is a guess.
Sorry. For anyone else wondering, this is the answer:
using (var context = new PrincipalContext(ContextType.Domain, System.DirectoryServices.ActiveDirectory.Domain.GetComputerDomain().Name))
using (var searcher = new PrincipalSearcher(new UserPrincipal(context)))
{
searcher.QueryFilter = new UserPrincipal(context) { Name = "*" };
foreach (var result in searcher.FindAll())
{
// result.Sid
}
}