Мне нужна помощь с приведенным ниже сценарием PowerShell для экспорта некоторой информации, такой как:
Name
Mail
ObjectClass
SMTP Address (only SMTP and smtp addresses)
DistinguishedName
RecipientTypeDetails --> This is to know what type of Mailbox (Shared, User,Resource,etc...)
WhenMailboxCreated
WhenChanged
WhenCreated
Identity
SKUAssigned
Потому что каким-то образом он показывает только: Name, Mail, ObjectClass и DistinguishedName, а столбец SMTP-адрес пуст?
У меня есть скрипт:
function Get-EmailAddress
{
[CmdletBinding()]
param
(
[Parameter(Mandatory = $True,
ValueFromPipeline = $True,
ValueFromPipelineByPropertyName = $True,
HelpMessage = 'What e-mail address would you like to find?')]
[string[]]$EmailAddress
)
process
{
foreach ($address in $EmailAddress)
{
Get-ADObject -Properties mail, proxyAddresses -Filter "mail -like '*$address*' -or proxyAddresses -like '*$address*'" |
Select Name,
Mail,
ObjectClass,
@{Label='SMTP Address';Expression={ $address.proxyAddresses | ?{ $address -Like "*smtp*" } -replace 'smtp:' -join ';' }},
DistinguishedName
Get-Recipient $address |
Select DisplayName,
RecipientType,
RecipientTypeDetails,
EmailAddresses,
*When*,
Identity,
SKUAssigned
}
}
}
Get-EmailAddress HelpDesk,ServiceDesk | Export-Csv -Path C:\TEMP\Result.csv -NoTypeInformation
Заранее спасибо.