PoshCode Archive  Artifact [37f5b57876]

Artifact 37f5b5787637a6eb5253335296eeb56d2a653fc9cef11cb423b40913877fab17:

  • File Clear-XCAttributes.ps1 — part of check-in [7ee8c075c5] at 2018-06-10 13:31:15 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: 3797
# x-archived: 2012-12-04T08:43:56
# x-published: 2012-11-29T04:48: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 
}