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

Q: how do I know how to present the result DO user name #46

Open
mwpowellhtx opened this issue Feb 24, 2024 · 3 comments
Open

Q: how do I know how to present the result DO user name #46

mwpowellhtx opened this issue Feb 24, 2024 · 3 comments

Comments

@mwpowellhtx
Copy link

mwpowellhtx commented Feb 24, 2024

i.e. as a local user, ".\user" along these lines, when the resulting DirectoryObject.Path is something like this, "WinNT://group/machineName/user". Any guidance around that, if you please. With group and machineName, ostensibly being the name of the local working group and machine names, respectively. Thanks so much...

@mwpowellhtx
Copy link
Author

To clarify, I can probably do some searching for string patterns and such from various dotnet sourced resources, but in particular, with regard to the Tulpep use case, and resulting instances. It is easy enough, for instance, to identify machine names, IIRC, and possibly even working group names, I do not know, as I am less familiar with that.

In general, my use case is to identify the principal that would be used to configure a Windows Service. If there is any guidance around that aspect, in general, would be greatly appreciated.

@mwpowellhtx
Copy link
Author

Here's a snippet that looks promising, but again, could this be stitched together by DirectoryObject in a bit more useful, cohesive manner, without extraneous consumer view model intervention.

var machineName = Environment.MachineName;
var compSys = new ManagementObject($"Win32_ComputerSystem.Name='{machineName}'");
var workgroupValue = compSys["Workgroup"];
var workgroup = $"{workgroupValue}";

Apparently, requirest at least System.Management package dependencies.

Such that, when we see something like this "WinNT://group/machineName/user", instead we are (correctly, IMO) presented with this ".\user", especially, in particular, when that user is a user on the local machine.

Verified under debugging.

@mwpowellhtx
Copy link
Author

Possibly also in need of the System.DirectoryServices.AccountManagement package, especially if you go the extra mile and validate credentials.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant