Hi
I have run this command successfully.
$userlist = get-content "c:userlist.txt"
$MailboxInfo
= ForEach ($user in $userlist) { get-mailbox $user | Select-object Displayname,
Database, SamAccountName, ServerName, Alias, PrimarySmtpAddress, RecipientType,
DistinguishedName, name}
= ForEach ($user in $userlist) { get-mailbox $user | Select-object Displayname,
Database, SamAccountName, ServerName, Alias, PrimarySmtpAddress, RecipientType,
DistinguishedName, name}
Then i wanted to access individual items within $mailboxinfo, so i could format it, so i thought i put it in a function like this sending the information to another function called report. i know running the previous command to get $mailboxinfo does have the correct data as i outputed it to a text file. But below is producing no data at all. I have not passed arguments before so am i doing it incorrectly?
Any help is really appreciated
Function GetMailboxDetails($MailboxInfo)
{ Foreach($Name in $MailboxInfo) {
$mdisplayname = $mailboxinfo.Displayname
$mdatabase = $MailboxInfo.Database
$mServerName = MailboxInfo.ServerName
$mSamAccountName = MailboxInfo.SamAccountName
$mAlias = MailboxInfo.Alias
$mPrimarySmtpAddress = MailboxInfo.PrimarySmtpAddress
$mRecipientType = MailboxInfo.RecipientType
$mDistinguishedName = MailboxInfo.DistinguishedName
$mname = MailboxInfo.name
Report $mDisplayname, $mDatabase, $mSamAccountName, $mServerName, $mAlias, $mPrimarySmtpAddress, $mRecipientType, $mDistinguishedName, $mname
}
}