Help with Powershell Script

Anthony K O365
Anthony K O365 used Ask the Experts™
on
I need help with the following:

Import-csv d:\displayname4.csv |foreach {$_.Name |select-object prohibitsendquota, issuewarningquota, prohibitsendreceivequota} |export-csv D:\QuotaLimit.csv

the csv is:
Name
Tom Smith
Sue Smith
Bob Smith

My Problem is two-fold
1-I'm missing a variable somewhere such $mail = Import-csv. Not sure where to place the variable.
2-If I place quotes around the user i.e. "Tom Smith"-when I open the csv in Notepad, it shows triple quotes """Tom Smith"""--causing issues with the script

Any thoughts?
Thanks!
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Solutions Architect
Commented:
you don't need quotes in the csv even if the name has spaces

$a = Import-csv d:\displayname4.csv

$a|foreach {get-mailbox $_.Name} |select-object name, prohibitsendquota, issuewarningquota, prohibitsendreceivequota |export-csv D:\QuotaLimit.csv
Subash SundharanIT Infrastructure Architect
Commented:
Get-mailbox is missing inside the foreach loop.. also the csv doesn't require quotes as mentioned by  Akhater. When you run the Import-csv command it should show result as shown in screenshot.
Import-csv d:\displayname4.csv |foreach {Get-mailbox $_.Name |select-object prohibitsendquota, issuewarningquota, prohibitsendreceivequota} |export-csv D:\QuotaLimit.csv

Open in new window

Import-csv
Anthony K O365Messaging Consulting

Author

Commented:
Excellent! This is what I was missing.
Anthony K O365Messaging Consulting

Author

Commented:
Excellent! This is what I was missing. Excellent service

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial