Solved

Help with Powershell Script

Posted on 2012-12-21
4
459 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Has Powershell sent you back into the Stone Age?

If managing Active Directory using Windows Powershell® is making you feel like you stepped back in time, you are not alone.  For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why.

Question has a verified solution.

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

A recent project that involved parsing Tableau Desktop and Server log files to extract reusable user queries for use in other systems. I chose to use PowerShell to gather the data, and SharePoint to present it...
In previous parts of this Nano Server deployment series, we learned how to create, deploy and configure Nano Server as a Hyper-V host. In this part, we will look for a clustering option. We will create a Hyper-V cluster of 3 Nano Server host nodes w…
In this video we show how to create an email address policy 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 Mail Flow…
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…
Suggested Courses

615 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