Getting the Username of an Active Directory user, not the IdentityReference. From the permissions of a folder
I am trying to return the username from the Security tab within a folder's properties. The user-friendly name next to the IdentityReference in brackets.
This is the current script I am using returns the IdentityReference of all attached active directory users of a given path. I was just wondering if there was a way to return that Username rather than the IdentityReference?
%SystemRoot%system32WindowsPowerShellv1.0powershell.exe -Command "& {(get-acl <path>).access | ft IdentityReference -auto}"
powershell
add a comment |
I am trying to return the username from the Security tab within a folder's properties. The user-friendly name next to the IdentityReference in brackets.
This is the current script I am using returns the IdentityReference of all attached active directory users of a given path. I was just wondering if there was a way to return that Username rather than the IdentityReference?
%SystemRoot%system32WindowsPowerShellv1.0powershell.exe -Command "& {(get-acl <path>).access | ft IdentityReference -auto}"
powershell
1
isn't the part after the slash the user [or group] name? [frown] it looks like that is the case on my win7 system ...
– Lee_Dailey
Nov 23 '18 at 18:43
The system and Admin are the same but the third one isn't, censored it because it has my name, but they are different.
– r1e2x310
Nov 23 '18 at 22:12
so ... what connection is there between the "your name" item and "your user name"? [grin] without any relationship ... it cannot be derived.
– Lee_Dailey
Nov 23 '18 at 23:49
add a comment |
I am trying to return the username from the Security tab within a folder's properties. The user-friendly name next to the IdentityReference in brackets.
This is the current script I am using returns the IdentityReference of all attached active directory users of a given path. I was just wondering if there was a way to return that Username rather than the IdentityReference?
%SystemRoot%system32WindowsPowerShellv1.0powershell.exe -Command "& {(get-acl <path>).access | ft IdentityReference -auto}"
powershell
I am trying to return the username from the Security tab within a folder's properties. The user-friendly name next to the IdentityReference in brackets.
This is the current script I am using returns the IdentityReference of all attached active directory users of a given path. I was just wondering if there was a way to return that Username rather than the IdentityReference?
%SystemRoot%system32WindowsPowerShellv1.0powershell.exe -Command "& {(get-acl <path>).access | ft IdentityReference -auto}"
powershell
powershell
edited Nov 23 '18 at 19:34
marc_s
576k12911111258
576k12911111258
asked Nov 23 '18 at 18:18
r1e2x310r1e2x310
1
1
1
isn't the part after the slash the user [or group] name? [frown] it looks like that is the case on my win7 system ...
– Lee_Dailey
Nov 23 '18 at 18:43
The system and Admin are the same but the third one isn't, censored it because it has my name, but they are different.
– r1e2x310
Nov 23 '18 at 22:12
so ... what connection is there between the "your name" item and "your user name"? [grin] without any relationship ... it cannot be derived.
– Lee_Dailey
Nov 23 '18 at 23:49
add a comment |
1
isn't the part after the slash the user [or group] name? [frown] it looks like that is the case on my win7 system ...
– Lee_Dailey
Nov 23 '18 at 18:43
The system and Admin are the same but the third one isn't, censored it because it has my name, but they are different.
– r1e2x310
Nov 23 '18 at 22:12
so ... what connection is there between the "your name" item and "your user name"? [grin] without any relationship ... it cannot be derived.
– Lee_Dailey
Nov 23 '18 at 23:49
1
1
isn't the part after the slash the user [or group] name? [frown] it looks like that is the case on my win7 system ...
– Lee_Dailey
Nov 23 '18 at 18:43
isn't the part after the slash the user [or group] name? [frown] it looks like that is the case on my win7 system ...
– Lee_Dailey
Nov 23 '18 at 18:43
The system and Admin are the same but the third one isn't, censored it because it has my name, but they are different.
– r1e2x310
Nov 23 '18 at 22:12
The system and Admin are the same but the third one isn't, censored it because it has my name, but they are different.
– r1e2x310
Nov 23 '18 at 22:12
so ... what connection is there between the "your name" item and "your user name"? [grin] without any relationship ... it cannot be derived.
– Lee_Dailey
Nov 23 '18 at 23:49
so ... what connection is there between the "your name" item and "your user name"? [grin] without any relationship ... it cannot be derived.
– Lee_Dailey
Nov 23 '18 at 23:49
add a comment |
1 Answer
1
active
oldest
votes
Why not just split on the '' and take the second position
((get-acl 'E:New Folder').access).IdentityReference
IdentityReference
-----------------
LabWS01TestAccount
BUILTINAdministrators
...
(((get-acl 'E:New Folder').access).IdentityReference -split '\')[1]
# Results
TestAccount
The above is on Win10 1809.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53451376%2fgetting-the-username-of-an-active-directory-user-not-the-identityreference-fro%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Why not just split on the '' and take the second position
((get-acl 'E:New Folder').access).IdentityReference
IdentityReference
-----------------
LabWS01TestAccount
BUILTINAdministrators
...
(((get-acl 'E:New Folder').access).IdentityReference -split '\')[1]
# Results
TestAccount
The above is on Win10 1809.
add a comment |
Why not just split on the '' and take the second position
((get-acl 'E:New Folder').access).IdentityReference
IdentityReference
-----------------
LabWS01TestAccount
BUILTINAdministrators
...
(((get-acl 'E:New Folder').access).IdentityReference -split '\')[1]
# Results
TestAccount
The above is on Win10 1809.
add a comment |
Why not just split on the '' and take the second position
((get-acl 'E:New Folder').access).IdentityReference
IdentityReference
-----------------
LabWS01TestAccount
BUILTINAdministrators
...
(((get-acl 'E:New Folder').access).IdentityReference -split '\')[1]
# Results
TestAccount
The above is on Win10 1809.
Why not just split on the '' and take the second position
((get-acl 'E:New Folder').access).IdentityReference
IdentityReference
-----------------
LabWS01TestAccount
BUILTINAdministrators
...
(((get-acl 'E:New Folder').access).IdentityReference -split '\')[1]
# Results
TestAccount
The above is on Win10 1809.
answered Nov 23 '18 at 23:47
postanotepostanote
3,5222410
3,5222410
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53451376%2fgetting-the-username-of-an-active-directory-user-not-the-identityreference-fro%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
isn't the part after the slash the user [or group] name? [frown] it looks like that is the case on my win7 system ...
– Lee_Dailey
Nov 23 '18 at 18:43
The system and Admin are the same but the third one isn't, censored it because it has my name, but they are different.
– r1e2x310
Nov 23 '18 at 22:12
so ... what connection is there between the "your name" item and "your user name"? [grin] without any relationship ... it cannot be derived.
– Lee_Dailey
Nov 23 '18 at 23:49