Solved

Help with Powershell Script

Posted on 2012-12-21
4
454 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

Office 365 Training for Admins - 7 Day Trial

Learn how to provision tenants, synchronize on-premise Active Directory, implement Single Sign-On, customize Office deployment, and protect your organization with eDiscovery and DLP policies.  Only from Platform Scholar.

Question has a verified solution.

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

This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
The following article is intended as a guide to using PowerShell as a more versatile and reliable form of application detection in SCCM.
To show how to create a transport rule 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 >> Rules tab.:  To cr…
how to add IIS SMTP to handle application/Scanner relays into office 365.

738 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