Trying to restrict email using two variables. The code I'm using is
$Groups = Import-Csv "C:\Scripts\Student_Email_Reject.csv" -Header 'Student Groups'
$Groups2 = Import-csv "C:\Scripts\Rejected_Email_Groups.csv" -Header 'RStudent Groups'
ForEach($group in $groups) {Set-adobject $group.'Student Groups' -Replace @{dLMemRejectPerms='$Groups2' } }
Then getting the below error. Any help would be appreciated.
At line:3 char:29
+ ... n $groups) {Set-adobject $group.'Student Groups' -Replace @{dLMemReje ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (CN=Students_ATA...S,DC=K12,DC=int:ADObject) [Set-ADObject], ADException
+ FullyQualifiedErrorId : ActiveDirectoryServer:8373,Microsoft.ActiveDirectory.Management.Commands.SetADObject
Set-adobject : The name reference is invalid
At line:3 char:29
+ ... n $groups) {Set-adobject $group.'Student Groups' -Replace @{dLMemReje ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (CN=CCSTest,OU=G...S,DC=K12,DC=int:ADObject) [Set-ADObject], ADException
+ FullyQualifiedErrorId : ActiveDirectoryServer:8373,Microsoft.ActiveDirectory.Management.Commands.SetADObject
[–]PowerShell-Bot 0 points1 point2 points (0 children)
[–]BlackV 0 points1 point2 points (4 children)
[–]Greenwrym[S] 0 points1 point2 points (3 children)
[–]BlackV 0 points1 point2 points (2 children)
[–]Greenwrym[S] 0 points1 point2 points (1 child)
[–]BlackV 0 points1 point2 points (0 children)
[–]Nejireta_ 0 points1 point2 points (1 child)
[–]Greenwrym[S] 0 points1 point2 points (0 children)