?
Solved

Modify a Power Shell Script

Posted on 2011-09-29
4
Medium Priority
?
256 Views
Last Modified: 2012-05-12
Can someone please modify this PowerShell script so that it will show the "Title" of the user in the output file?

Get-MailboxServer | Get-Mailbox -ResultSize Unlimited |
Get-MailboxStatistics | Where {$_.TotalItemSize -gt 1MB} |
Select DisplayName, LegacyDN, ItemCount,  `
   @{label="CalendarItemSize (MB)";expression={(Get-MailboxFolderStatistics -Identity $_.Identity -FolderScope Calendar).FolderAndSubfolderSize.ToMB()}},  `
   @{label="Total Deleted Size (MB)";expression={$_.TotalDeletedItemSize.Value.ToMB()}},  `
   @{label="Total Size (MB)";expression={$_.TotalItemSize.Value.ToMB()}},  `
   StorageLimitStatus,  Database, LastLogonTime |
Export-Csv All_users_mailbox_sizeV5All-9-28-2011.csv -notypeinformation
0
Comment
Question by:vhaperbaugub
[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
  • 3
4 Comments
 
LVL 27

Expert Comment

by:KenMcF
ID: 36814267
try adding this into your script.


Get-MailboxServer | Get-Mailbox -ResultSize Unlimited | 
Get-MailboxStatistics | Where {$_.TotalItemSize -gt 1MB} | 
Select DisplayName, LegacyDN, ItemCount,
   @{label="CalendarItemSize (MB)";expression={(Get-MailboxFolderStatistics -Identity $_.Identity -FolderScope Calendar).FolderAndSubfolderSize.ToMB()}},
   @{label="Total Deleted Size (MB)";expression={$_.TotalDeletedItemSize.Value.ToMB()}},
   @{label="Total Size (MB)";expression={$_.TotalItemSize.Value.ToMB()}},
   @{label="Title";expression={get-user $_.samaccountname}},
   StorageLimitStatus,  Database, LastLogonTime | 
Export-Csv All_users_mailbox_sizeV5All-9-28-2011.csv -notypeinformation

Open in new window

0
 
LVL 27

Expert Comment

by:KenMcF
ID: 36814331
wait, forgot something in my last post

replace this line

@{label="Title";expression={get-user $_.samaccountname}},

With this

@{label="Title";expression={(get-user $_.samaccountname).title}},
0
 
LVL 27

Accepted Solution

by:
KenMcF earned 2000 total points
ID: 36814374
one more try, after testing this time

@{label="Title";expression={(get-user $_.displayname).title}},
0
 

Author Comment

by:vhaperbaugub
ID: 36814510
Looks like it is working great.....Thanks!
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Auditing domain password hashes is a commonly overlooked but critical requirement to ensuring secure passwords practices are followed. Methods exist to extract hashes directly for a live domain however this article describes a process to extract u…
In this post we will be converting StringData saved within a text file into a hash table. This can be further used in a PowerShell script for replacing settings that are dynamic in nature from environment to environment.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

764 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