Solved

Help with Powershell Script

Posted on 2012-12-21
4
443 Views
Last Modified: 2012-12-21
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!
0
Comment
Question by:K Anthony O365
  • 2
4 Comments
 
LVL 49

Accepted Solution

by:
Akhater earned 250 total points
ID: 38713862
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
0
 
LVL 40

Assisted Solution

by:Subsun
Subsun earned 250 total points
ID: 38713940
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
0
 

Author Comment

by:K Anthony O365
ID: 38714537
Excellent! This is what I was missing.
0
 

Author Closing Comment

by:K Anthony O365
ID: 38714541
Excellent! This is what I was missing. Excellent service
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Find out what you should include to make the best professional email signature for your organization.
The following article is intended as a guide to using PowerShell as a more versatile and reliable form of application detection in SCCM.
In this video we show how to create a mailbox database in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Servers >> Data‚Ķ
how to add IIS SMTP to handle application/Scanner relays into office 365.

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question