Solved

Modify a Power Shell Script

Posted on 2011-09-29
4
243 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
  • 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 500 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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Utilizing an array to gracefully append to a list of EmailAddresses
This script checks a path to see if a folder exists. If the folder does exist you will get output "The folder has previously been created. No action taken" If not it will create the folder. Then adds one user modify permission to the folder. It …
This video discusses moving either the default database or any database to a new volume.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

760 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now