PoshCode Archive  Artifact [e8f3376e1a]

Artifact e8f3376e1adb6ae3f0b021fa8db6aebf1d1f7300e3e8974fef704bd1e9ea40d0:

  • File Clear-XCAttributes.ps1 — part of check-in [f3fb19edbd] at 2018-06-10 13:31:50 on branch trunk — clear exchange 2003 attributes from AD users (user: chriskenis size: 2076)

# encoding: ascii
# api: powershell
# title: Clear-XCAttributes
# description: clear exchange 2003 attributes from AD users
# version: 0.1
# type: script
# author: chriskenis
# license: CC0
# x-poshcode-id: 3830
# x-archived: 2012-12-22T08:41:06
# x-published: 2012-12-19T08:32:00
#
#
param(
[Parameter(Position=0,ValueFromPipeline=$True)]
[ValidateNotNullorEmpty()] $User,
[switch]$ClearXCAttributes
)

begin{
$Global:LegacyXCUsers = @()
# attributes to be nulled according to:
# http://blogs.technet.com/b/exchange/archive/2006/10/13/3395089.aspx
$XCattributes=@(
"adminDisplayName","altRecipient","authOrig","autoReplyMessage","deletedItemFlags","delivContLength","deliverAndRedirect","displayNamePrintable",
"dLMemDefault","dLMemRejectPerms","dLMemSubmitPerms","extensionAttribute1","extensionAttribute10","extensionAttribute11","extensionAttribute12",
"extensionAttribute13","extensionAttribute14","extensionAttribute15","extensionAttribute2","extensionAttribute3","extensionAttribute4","extensionAttribute5",
"extensionAttribute6","extensionAttribute7","extensionAttribute8","extensionAttribute9","folderPathname","garbageCollPeriod","homeMDB","homeMTA",
"internetEncoding","legacyExchangeDN","mail","mailNickname","mAPIRecipient","mDBOverHardQuotaLimit","mDBOverQuotaLimit","mDBStorageQuota","mDBUseDefaults",
"msExchADCGlobalNames","msExchControllingZone","msExchExpansionServerName","msExchFBURL","msExchHideFromAddressLists","msExchHomeServerName",
"msExchMailboxGuid","msExchMailboxSecurityDescriptor","msExchPoliciesExcluded","msExchPoliciesIncluded","msExchRecipLimit","msExchResourceGUID",
"protocolSettings","proxyAddresses","publicDelegates","securityProtocol","showInAddressBook","submissionContLength","targetAddress","textEncodedORAddress",
"unauthOrig"
)
}

process{
$Global:LegacyXCUsers += (get-aduser -Identity $User -Properties *)
if ($ClearXCAttributes){
	write-verbose "all XC attributes will be cleared for $user"
	set-aduser -Identity $User -Clear $XCattributes
	}
	
}

end{
$Global:LegacyXCUsers 
}