Skip to content

Instantly share code, notes, and snippets.

@torgro
Created November 10, 2015 14:37
Show Gist options
  • Select an option

  • Save torgro/ae158ae650bd69fd2940 to your computer and use it in GitHub Desktop.

Select an option

Save torgro/ae158ae650bd69fd2940 to your computer and use it in GitHub Desktop.
$users = Get-ADGroupMember G_Email_Archive_2013 | Select-Object -ExpandProperty name
foreach ($user in $users)
{
# Extract Mailbox GUID and pipe to variable $GUID
$GUID = Get-Mailbox $user | select ExchangeGUID
$customAttrib3 = Get-Mailbox -Identity $user -CustomAttribute3 -ErrorAction SilentlyContinue
if($customAttrib3)
{
#dersom CustomAttrib3 har verdi, så kan vi gjøre noe her
}
else
{
#customattrib3 er tom, sett verdi
set-mailbox $user -CustomAttribute3 "iXOS-EXLK:/{$($GUID.ExchangeGuid)}"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment