Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

Script Issue - Process[0]?

$
0
0

Good Morning Everyone,

I have written a script to get a list of users from Active Directory and compare them with mailboxes we have in O365 to get their ForwardingSMTPAddress - for some reason I am getting prompted to enter: Process[0] when my For-Each loop starts, I am unsure of where the error is in my script, please could you take a look and advise. Thanks Smile

Get-ADUser-Filter * -SearchBase '<OU>'-Properties mail | `ForEach-Object
{$Mailbox=Get-Mailbox-identity $_.mail |Select-Object PrimarySMTPAddress, ForwardingSMTPAddressNew-Object-TypeName PSCustomObject -Property @{
        EmailAddress =$_.PrimarySMTPAddress
        ForwardingAddress =$_.ForwardingSMTPAddress
    }
} |Export-Csv-Path<CSV Location> -NoTypeInformation

Viewing all articles
Browse latest Browse all 6937

Trending Articles