Powershell get unique entry of first column of an arrayHow do I get the current username in Windows PowerShell?Powershell: Deduping an arrayTrying to export an array to csv using powershell (array objects are ; delimited and contain newlines)Powershell Array questionGetting names of folders that do not inherit permissionsPowerShell get-acl List folder contents vs ReadAndExecutecalling a variable in select -expandpropertyPowerShell Get the first date from event viewer for all entriesPowershell Dynamic Menu Based on Mailbox Permission EntriesI can't get Powershell StartsWith function to work
What is the difference between nullifying your vote and not going to vote at all?
Is this light switch installation safe and legal?
Can't connect to Internet in bash using Mac OS
Beginner's snake game using PyGame
Is having a hidden directory under /etc safe?
What does the behaviour of water on the skin of an aircraft in flight tell us?
What caused the tendency for conservatives to not support climate change regulations?
Is it possible to change original filename of an exe?
The qvolume of an integer
Possible nonclassical ion from a bicyclic system
How to prevent bad sectors?
60s (or earlier) short story where each colony has one person who doesn't connect well with others who is there for being able to absorb knowledge
Infinitely many hats
Can't the Time Stone be touched with bare hands?
Can non-English-speaking characters use wordplay specific to English?
Why to use water tanks from Space shuttle in museum?
Decrypting WPA2-Enterprise (EAP-PEAP) in Wireshark
Is there an explanation for Austria's Freedom Party virtually retaining its vote share despite recent scandal?
How can I prevent interns from being expendable?
How to detach yourself from a character you're going to kill?
Draw a checker pattern with a black X in the center
SPI on stm32 won't work without pullup resistors and even then performs poorly
Thousands and thousands of words
Term for checking piece whose opponent daren't capture it
Powershell get unique entry of first column of an array
How do I get the current username in Windows PowerShell?Powershell: Deduping an arrayTrying to export an array to csv using powershell (array objects are ; delimited and contain newlines)Powershell Array questionGetting names of folders that do not inherit permissionsPowerShell get-acl List folder contents vs ReadAndExecutecalling a variable in select -expandpropertyPowerShell Get the first date from event viewer for all entriesPowershell Dynamic Menu Based on Mailbox Permission EntriesI can't get Powershell StartsWith function to work
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I'm trying to get unique entries from reading out Filepermissions.
I got the following code snippet. It gives me a list with 2 arrays, one Identityreference and one FileSystemRights.
$ACLFile = Get-Acl -Path $dir -Filter Access | Select-Object -ExpandProperty Access | Where-Object $_.IdentityReference -like "EBK*" | Select-Object IdentityReference, FileSystemRights
$ACLFile = $ACLFile.IdentityReference | select -unique
Now what I did here only gives me IdentityReference as a result but i need both. If I remove the $ACLFile.IdentityReference
and just write $ACLLFile
it removes duplicates from the FileSystemRights columns but I want only the other column as indicator.
powershell scripting
add a comment |
I'm trying to get unique entries from reading out Filepermissions.
I got the following code snippet. It gives me a list with 2 arrays, one Identityreference and one FileSystemRights.
$ACLFile = Get-Acl -Path $dir -Filter Access | Select-Object -ExpandProperty Access | Where-Object $_.IdentityReference -like "EBK*" | Select-Object IdentityReference, FileSystemRights
$ACLFile = $ACLFile.IdentityReference | select -unique
Now what I did here only gives me IdentityReference as a result but i need both. If I remove the $ACLFile.IdentityReference
and just write $ACLLFile
it removes duplicates from the FileSystemRights columns but I want only the other column as indicator.
powershell scripting
add a comment |
I'm trying to get unique entries from reading out Filepermissions.
I got the following code snippet. It gives me a list with 2 arrays, one Identityreference and one FileSystemRights.
$ACLFile = Get-Acl -Path $dir -Filter Access | Select-Object -ExpandProperty Access | Where-Object $_.IdentityReference -like "EBK*" | Select-Object IdentityReference, FileSystemRights
$ACLFile = $ACLFile.IdentityReference | select -unique
Now what I did here only gives me IdentityReference as a result but i need both. If I remove the $ACLFile.IdentityReference
and just write $ACLLFile
it removes duplicates from the FileSystemRights columns but I want only the other column as indicator.
powershell scripting
I'm trying to get unique entries from reading out Filepermissions.
I got the following code snippet. It gives me a list with 2 arrays, one Identityreference and one FileSystemRights.
$ACLFile = Get-Acl -Path $dir -Filter Access | Select-Object -ExpandProperty Access | Where-Object $_.IdentityReference -like "EBK*" | Select-Object IdentityReference, FileSystemRights
$ACLFile = $ACLFile.IdentityReference | select -unique
Now what I did here only gives me IdentityReference as a result but i need both. If I remove the $ACLFile.IdentityReference
and just write $ACLLFile
it removes duplicates from the FileSystemRights columns but I want only the other column as indicator.
powershell scripting
powershell scripting
edited Mar 24 at 9:57
marc_s
591k13311301278
591k13311301278
asked Mar 7 at 15:34


seyo -IVseyo -IV
306
306
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
You could just use Sort-Object
here:
$ACLFile | Sort-Object IdentityReference -unique
However, there are issues with this approach alone. You will lose your additional FileSystemRights
property value for the duplicate IdentityReference
. Are you wanting to combine all FileSystemRights
belonging to the same IdentityReference
into one line?
The following will remove duplicate IdentityReferences
and combine FileSystemRights
:
$ACLGroup = $ACLFile | Group-Object IdentityReference
$Singles = $ACLGroup.where($_.count -eq 1).group
$Duplicates = $ACLGroup.where($_.count -gt 1)
$ItemizedDuplicates = $Duplicates | foreach
[pscustomobject][ordered]@"IdentityReference"=$_.Group.IdentityReference[0]; "FileSystemRights" = $_.Group.FileSystemRights -join ", "
@($ItemizedDuplicates,$Singles)
Nice exactly what i needed.
– seyo -IV
Mar 8 at 10:09
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%2f55047507%2fpowershell-get-unique-entry-of-first-column-of-an-array%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
You could just use Sort-Object
here:
$ACLFile | Sort-Object IdentityReference -unique
However, there are issues with this approach alone. You will lose your additional FileSystemRights
property value for the duplicate IdentityReference
. Are you wanting to combine all FileSystemRights
belonging to the same IdentityReference
into one line?
The following will remove duplicate IdentityReferences
and combine FileSystemRights
:
$ACLGroup = $ACLFile | Group-Object IdentityReference
$Singles = $ACLGroup.where($_.count -eq 1).group
$Duplicates = $ACLGroup.where($_.count -gt 1)
$ItemizedDuplicates = $Duplicates | foreach
[pscustomobject][ordered]@"IdentityReference"=$_.Group.IdentityReference[0]; "FileSystemRights" = $_.Group.FileSystemRights -join ", "
@($ItemizedDuplicates,$Singles)
Nice exactly what i needed.
– seyo -IV
Mar 8 at 10:09
add a comment |
You could just use Sort-Object
here:
$ACLFile | Sort-Object IdentityReference -unique
However, there are issues with this approach alone. You will lose your additional FileSystemRights
property value for the duplicate IdentityReference
. Are you wanting to combine all FileSystemRights
belonging to the same IdentityReference
into one line?
The following will remove duplicate IdentityReferences
and combine FileSystemRights
:
$ACLGroup = $ACLFile | Group-Object IdentityReference
$Singles = $ACLGroup.where($_.count -eq 1).group
$Duplicates = $ACLGroup.where($_.count -gt 1)
$ItemizedDuplicates = $Duplicates | foreach
[pscustomobject][ordered]@"IdentityReference"=$_.Group.IdentityReference[0]; "FileSystemRights" = $_.Group.FileSystemRights -join ", "
@($ItemizedDuplicates,$Singles)
Nice exactly what i needed.
– seyo -IV
Mar 8 at 10:09
add a comment |
You could just use Sort-Object
here:
$ACLFile | Sort-Object IdentityReference -unique
However, there are issues with this approach alone. You will lose your additional FileSystemRights
property value for the duplicate IdentityReference
. Are you wanting to combine all FileSystemRights
belonging to the same IdentityReference
into one line?
The following will remove duplicate IdentityReferences
and combine FileSystemRights
:
$ACLGroup = $ACLFile | Group-Object IdentityReference
$Singles = $ACLGroup.where($_.count -eq 1).group
$Duplicates = $ACLGroup.where($_.count -gt 1)
$ItemizedDuplicates = $Duplicates | foreach
[pscustomobject][ordered]@"IdentityReference"=$_.Group.IdentityReference[0]; "FileSystemRights" = $_.Group.FileSystemRights -join ", "
@($ItemizedDuplicates,$Singles)
You could just use Sort-Object
here:
$ACLFile | Sort-Object IdentityReference -unique
However, there are issues with this approach alone. You will lose your additional FileSystemRights
property value for the duplicate IdentityReference
. Are you wanting to combine all FileSystemRights
belonging to the same IdentityReference
into one line?
The following will remove duplicate IdentityReferences
and combine FileSystemRights
:
$ACLGroup = $ACLFile | Group-Object IdentityReference
$Singles = $ACLGroup.where($_.count -eq 1).group
$Duplicates = $ACLGroup.where($_.count -gt 1)
$ItemizedDuplicates = $Duplicates | foreach
[pscustomobject][ordered]@"IdentityReference"=$_.Group.IdentityReference[0]; "FileSystemRights" = $_.Group.FileSystemRights -join ", "
@($ItemizedDuplicates,$Singles)
edited Mar 7 at 18:07
answered Mar 7 at 16:34
AdminOfThingsAdminOfThings
3,3202214
3,3202214
Nice exactly what i needed.
– seyo -IV
Mar 8 at 10:09
add a comment |
Nice exactly what i needed.
– seyo -IV
Mar 8 at 10:09
Nice exactly what i needed.
– seyo -IV
Mar 8 at 10:09
Nice exactly what i needed.
– seyo -IV
Mar 8 at 10:09
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%2f55047507%2fpowershell-get-unique-entry-of-first-column-of-an-array%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