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

foreach loop

$
0
0

This is due to my comprehension issues, but I'm trying to find a way to import a list of names from a text file, and get their primarysmtpaddress and alias. 

Of course, when I run:

Get-Content c:\Source\MultiUser.txt | Get-Mailbox | Select-Object alias,primarysmtpaddress

I get the following:

The operation couldn't be performed because object '"lastname, firstname"' couldn't be found on 'domain controller'

I've tried to work in a 'foreach' loop after the get-content command, but I fail at understanding how to properly write this command.

Any help will be sincerely appreciated.


Viewing all articles
Browse latest Browse all 8583

Trending Articles