Avatar of Jakob Digranes
Jakob DigranesFlag for Norway

asked on 

remove Custom Attribute for users not in group

HI Powershell Guruz; I received some help for the script in the thread below.
https://www.experts-exchange.com/questions/28827119/need-to-set-CustomAttribute-based-on-mailboxGUID.html

No I need to somewhat reverse it, need to get all user who are not a member of the but, but have value in -CustomAttribute1 - and after that clear CustomAttribute for those users --- any ideas?


$users = Get-ADGroupMember Test_MBX_Permission | Select-Object -ExpandProperty name
foreach ($user in $users)
{
    $userinfo = Get-Mailbox -Identity $user -ErrorAction SilentlyContinue | select
    if NOT A MEMBER OF THE GROUP
    {
        #If customattribute1 have value - SET VALUE TO Null
    }
    else
    {

    }
}

?????
ExchangePowershell

Avatar of undefined
Last Comment
footech
ASKER CERTIFIED SOLUTION
Avatar of footech
footech
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of Jakob Digranes

ASKER

That one seemed to the trick. However, it seems now that users can be member of 3 groups. Is that even possible? to get it to traverse through 3 groups and then check?
Avatar of Jakob Digranes

ASKER

got it ... All groups start with the same name; so changed like this:

$ge = Get-ADGroup -LDAPFilter "(name=G_Email_archive*)" | Get-ADGroupMember -Recursive | Select samaccountname

Thanks !
Avatar of footech
footech
Flag of United States of America image

Super!
Exchange
Exchange

Exchange is the server side of a collaborative application product that is part of the Microsoft Server infrastructure. Exchange's major features include email, calendaring, contacts and tasks, support for mobile and web-based access to information, and support for data storage.

213K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo