PSCustomObject Not Assigning Data

Ask your PowerShell-related questions, including questions on cmdlet development!
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 11 months and 4 weeks old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
ICTPSOSSPA
Posts: 1
Last visit: Wed Aug 16, 2023 12:54 am

PSCustomObject Not Assigning Data

Post by ICTPSOSSPA »

I am having issues where I am unable to assign the value of the variable $Folder_Access_Check.Identity to an array.
Outside of Powershell Studio 2023 (in ISE) I have the same code working without issue and I'm trying to move it to a GUI but can't seem to work around this issue. Any advice would be appreciated :)
Code: [Select all] [Expand/Collapse] [Download] (UserAccessCheck.ps1)
  1.    
  2. $DATA_ACLS = RandomName
  3. $Folder_Access_Checks = Get-Acl $FolderPath | ForEach-Object { $_.Access } | Select-Object -Property @{ n = "Identity"; e = { $_.IdentityReference.ToString().Split("\")[1] } }
  4.    
  5.     If ($cmb_organisations.Text -eq "My Org")
  6.     {
  7.         Foreach ($Folder_Access_Check in $Folder_Access_Checks)
  8.         {
  9.             If ($($Folder_Access_Check.identity) -contains $DATA_ACLS)
  10.             {
  11.                 $Valid_Folder_Groups += $Folder_Access_Check.Identity
  12.             }
  13.         }
  14.     }
$Valid_Folder_Groups += $Folder_Access_Check.Identity - this is the line that fails as it's not adding the information to the $Valid_Folder_Groups variable.
This topic is 11 months and 4 weeks old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked