meenkey
asked on
Exchange 2010 PowerShell script throwing errors on specific users.
I have been given the task to track the size of each users inbox, deleted items, sent items, and calendar. I do not find much on the googles for reporting just inbox size, rather most IT seem to report the entire mailbox size. I did however find and slightly modify the script below that works perfectly on 776/822 of our users. with the other 46 users I get the error below. I have tried for longer then I am willing to admit trying to get this script and others to work. Possibly there is a different way to loop this, I can manually pull information from the users, just not with the scripting methods I have tried.
You cannot call a method on a null-valued expression.
At line:10 char:127
+ $mbObj | Add-Member -MemberType NoteProperty -Name "Inbox Size (Mb)" -Value $inboxstats.FolderandSubFo lder
Size.ToMB <<<< ()
+ CategoryInfo : InvalidOperation: (ToMB:String) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
The error repeats for all 4 boxes. Here is the script I am using
$mailboxes = @(Get-Mailbox -ResultSize Unlimited)
$report = @()
foreach ($mailbox in $mailboxes)
{
$inboxstats = Get-MailboxFolderStatistic s $mailbox -FolderScope Inbox | Where {$_.FolderPath -eq "/Inbox"}
$deletedstats = Get-MailboxFolderStatistic s $mailbox | Where {$_.FolderPath -eq "/Deleted Items"}
$sentitemstats = Get-MailboxFolderStatistic s $mailbox | Where {$_.FolderPath -eq "/Sent Items"}
$calendarstats = Get-MailboxFolderStatistic s $mailbox | Where {$_.FolderPath -eq "/Calendar"}
Write-Host "Getting Stats for " $mailbox.DisplayName -ForegroundColor Green
$mbObj = New-Object PSObject
$mbObj | Add-Member -MemberType NoteProperty -Name "Display Name" -Value $mailbox.DisplayName
$mbObj | Add-Member -MemberType NoteProperty -Name "Inbox Size (Mb)" -Value $inboxstats.FolderandSubFo lderSize.T oMB()
$mbObj | Add-Member -MemberType NoteProperty -Name "Deleted Items(MB)" -Value $deletedstats.FolderAndSub folderSize .ToMB()
$mbObj | Add-Member -MemberType NoteProperty -Name "Sent Items(MB)" -Value $sentitemstats.FolderAndSu bfolderSiz e.ToMB()
$mbObj | Add-Member -MemberType NoteProperty -Name "Calendar(MB)" -Value $calendarstats.FolderAndSu bfolderSiz e.ToMB()
$report += $mbObj
}
$report | Export-Csv c:\Temp\Report.csv -NoTypeInformation
You cannot call a method on a null-valued expression.
At line:10 char:127
+ $mbObj | Add-Member -MemberType NoteProperty -Name "Inbox Size (Mb)" -Value $inboxstats.FolderandSubFo
Size.ToMB <<<< ()
+ CategoryInfo : InvalidOperation: (ToMB:String) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
The error repeats for all 4 boxes. Here is the script I am using
$mailboxes = @(Get-Mailbox -ResultSize Unlimited)
$report = @()
foreach ($mailbox in $mailboxes)
{
$inboxstats = Get-MailboxFolderStatistic
$deletedstats = Get-MailboxFolderStatistic
$sentitemstats = Get-MailboxFolderStatistic
$calendarstats = Get-MailboxFolderStatistic
Write-Host "Getting Stats for " $mailbox.DisplayName -ForegroundColor Green
$mbObj = New-Object PSObject
$mbObj | Add-Member -MemberType NoteProperty -Name "Display Name" -Value $mailbox.DisplayName
$mbObj | Add-Member -MemberType NoteProperty -Name "Inbox Size (Mb)" -Value $inboxstats.FolderandSubFo
$mbObj | Add-Member -MemberType NoteProperty -Name "Deleted Items(MB)" -Value $deletedstats.FolderAndSub
$mbObj | Add-Member -MemberType NoteProperty -Name "Sent Items(MB)" -Value $sentitemstats.FolderAndSu
$mbObj | Add-Member -MemberType NoteProperty -Name "Calendar(MB)" -Value $calendarstats.FolderAndSu
$report += $mbObj
}
$report | Export-Csv c:\Temp\Report.csv -NoTypeInformation
ASKER
Narender,
I tried this
$mailboxes = @(Get-Mailbox <username>)
$report = @()
foreach ($mailbox in $mailboxes)
{
$inboxstats = Get-MailboxFolderStatistic s $mailbox -FolderScope Inbox | Where {$_.FolderPath -eq "/Inbox"}
$deletedstats = Get-MailboxFolderStatistic s $mailbox | Where {$_.FolderPath -eq "/Deleted Items"}
$sentitemstats = Get-MailboxFolderStatistic s $mailbox | Where {$_.FolderPath -eq "/Sent Items"}
$calendarstats = Get-MailboxFolderStatistic s $mailbox | Where {$_.FolderPath -eq "/Calendar"}
Write-Host "Getting Stats for " $mailbox.DisplayName -ForegroundColor Green
$mbObj = New-Object PSObject
$mbObj | Add-Member -MemberType NoteProperty -Name "Display Name" -Value $mailbox.DisplayName
$mbObj | Add-Member -MemberType NoteProperty -Name "Inbox Size (Mb)" -Value $inboxstats.FolderandSubFo lderSize / 1mb
$mbObj | Add-Member -MemberType NoteProperty -Name "Deleted Items(MB)" -Value $deletedstats.FolderAndSub folderSize / 1mb
$mbObj | Add-Member -MemberType NoteProperty -Name "Sent Items(MB)" -Value $sentitemstats.FolderAndSu bfolderSiz e / 1mb
$mbObj | Add-Member -MemberType NoteProperty -Name "Calendar(MB)" -Value $calendarstats.FolderAndSu bfolderSiz e / 1mb
$report += $mbObj
}
and got this error
Add-Member : A positional parameter cannot be found that accepts argument '1mb'.
At line:10 char:31
+ $mbObj | Add-Member <<<< -MemberType NoteProperty -Name "Inbox Size (Mb)" -Value $inboxstats.FolderandSub
FolderSize / 1mb
+ CategoryInfo : InvalidArgument: (:) [Add-Member], ParameterBindingException
+ FullyQualifiedErrorId : PositionalParameterNotFoun d,Microsof t.PowerShe ll.Command s.AddMembe rCommand
I tried this
$mailboxes = @(Get-Mailbox <username>)
$report = @()
foreach ($mailbox in $mailboxes)
{
$inboxstats = Get-MailboxFolderStatistic
$deletedstats = Get-MailboxFolderStatistic
$sentitemstats = Get-MailboxFolderStatistic
$calendarstats = Get-MailboxFolderStatistic
Write-Host "Getting Stats for " $mailbox.DisplayName -ForegroundColor Green
$mbObj = New-Object PSObject
$mbObj | Add-Member -MemberType NoteProperty -Name "Display Name" -Value $mailbox.DisplayName
$mbObj | Add-Member -MemberType NoteProperty -Name "Inbox Size (Mb)" -Value $inboxstats.FolderandSubFo
$mbObj | Add-Member -MemberType NoteProperty -Name "Deleted Items(MB)" -Value $deletedstats.FolderAndSub
$mbObj | Add-Member -MemberType NoteProperty -Name "Sent Items(MB)" -Value $sentitemstats.FolderAndSu
$mbObj | Add-Member -MemberType NoteProperty -Name "Calendar(MB)" -Value $calendarstats.FolderAndSu
$report += $mbObj
}
and got this error
Add-Member : A positional parameter cannot be found that accepts argument '1mb'.
At line:10 char:31
+ $mbObj | Add-Member <<<< -MemberType NoteProperty -Name "Inbox Size (Mb)" -Value $inboxstats.FolderandSub
FolderSize / 1mb
+ CategoryInfo : InvalidArgument: (:) [Add-Member], ParameterBindingException
+ FullyQualifiedErrorId : PositionalParameterNotFoun
Sorry, can you please try to remove .ToMB() function completely from your initial version and try if it succeeds.
If yes, then you can convert the string value manually, it seems that the value which is returning for the 46 users is not a string.
If yes, then you can convert the string value manually, it seems that the value which is returning for the 46 users is not a string.
ASKER
Yes, that is what my last post showed?? is this what you are looking for ?
$mailboxes = @(Get-Mailbox <user>)
$report = @()
foreach ($mailbox in $mailboxes)
{
$inboxstats = Get-MailboxFolderStatistic s $mailbox -FolderScope Inbox | Where {$_.FolderPath -eq "/Inbox"}
$deletedstats = Get-MailboxFolderStatistic s $mailbox | Where {$_.FolderPath -eq "/Deleted Items"}
$sentitemstats = Get-MailboxFolderStatistic s $mailbox | Where {$_.FolderPath -eq "/Sent Items"}
$calendarstats = Get-MailboxFolderStatistic s $mailbox | Where {$_.FolderPath -eq "/Calendar"}
Write-Host "Getting Stats for " $mailbox.DisplayName -ForegroundColor Green
$mbObj = New-Object PSObject
$mbObj | Add-Member -MemberType NoteProperty -Name "Display Name" -Value $mailbox.DisplayName
$mbObj | Add-Member -MemberType NoteProperty -Name "Inbox Size (Mb)" -Value $inboxstats.FolderandSubFo lderSize / 1mb()
$mbObj | Add-Member -MemberType NoteProperty -Name "Deleted Items(MB)" -Value $deletedstats.FolderAndSub folderSize / 1mb()
$mbObj | Add-Member -MemberType NoteProperty -Name "Sent Items(MB)" -Value $sentitemstats.FolderAndSu bfolderSiz e / 1mb()
$mbObj | Add-Member -MemberType NoteProperty -Name "Calendar(MB)" -Value $calendarstats.FolderAndSu bfolderSiz e / 1mb()
$report += $mbObj
}
I have this changed out "......FolderandSubFolderS ize / 1mb()"
with this script I get this error
An expression was expected after '('.
At line:10 char:130
+ $mbObj | Add-Member -MemberType NoteProperty -Name "Inbox Size (Mb)" -Value $inboxstats.FolderandSubFo lder
Size / 1mb( <<<< )
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordE xception
+ FullyQualifiedErrorId : ExpectedExpression
$mailboxes = @(Get-Mailbox <user>)
$report = @()
foreach ($mailbox in $mailboxes)
{
$inboxstats = Get-MailboxFolderStatistic
$deletedstats = Get-MailboxFolderStatistic
$sentitemstats = Get-MailboxFolderStatistic
$calendarstats = Get-MailboxFolderStatistic
Write-Host "Getting Stats for " $mailbox.DisplayName -ForegroundColor Green
$mbObj = New-Object PSObject
$mbObj | Add-Member -MemberType NoteProperty -Name "Display Name" -Value $mailbox.DisplayName
$mbObj | Add-Member -MemberType NoteProperty -Name "Inbox Size (Mb)" -Value $inboxstats.FolderandSubFo
$mbObj | Add-Member -MemberType NoteProperty -Name "Deleted Items(MB)" -Value $deletedstats.FolderAndSub
$mbObj | Add-Member -MemberType NoteProperty -Name "Sent Items(MB)" -Value $sentitemstats.FolderAndSu
$mbObj | Add-Member -MemberType NoteProperty -Name "Calendar(MB)" -Value $calendarstats.FolderAndSu
$report += $mbObj
}
I have this changed out "......FolderandSubFolderS
with this script I get this error
An expression was expected after '('.
At line:10 char:130
+ $mbObj | Add-Member -MemberType NoteProperty -Name "Inbox Size (Mb)" -Value $inboxstats.FolderandSubFo
Size / 1mb( <<<< )
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordE
+ FullyQualifiedErrorId : ExpectedExpression
I meant to remove /mb too so the new looks like below.
$mailboxes = @(Get-Mailbox <user>)
$report = @()
foreach ($mailbox in $mailboxes)
{
$inboxstats = Get-MailboxFolderStatistic s $mailbox -FolderScope Inbox | Where {$_.FolderPath -eq "/Inbox"}
$deletedstats = Get-MailboxFolderStatistic s $mailbox | Where {$_.FolderPath -eq "/Deleted Items"}
$sentitemstats = Get-MailboxFolderStatistic s $mailbox | Where {$_.FolderPath -eq "/Sent Items"}
$calendarstats = Get-MailboxFolderStatistic s $mailbox | Where {$_.FolderPath -eq "/Calendar"}
Write-Host "Getting Stats for " $mailbox.DisplayName -ForegroundColor Green
$mbObj = New-Object PSObject
$mbObj | Add-Member -MemberType NoteProperty -Name "Display Name" -Value $mailbox.DisplayName
$mbObj | Add-Member -MemberType NoteProperty -Name "Inbox Size (Mb)" -Value $inboxstats.FolderandSubFo lderSize
$mbObj | Add-Member -MemberType NoteProperty -Name "Deleted Items(MB)" -Value $deletedstats.FolderAndSub folderSize
$mbObj | Add-Member -MemberType NoteProperty -Name "Sent Items(MB)" -Value $sentitemstats.FolderAndSu bfolderSiz e
$mbObj | Add-Member -MemberType NoteProperty -Name "Calendar(MB)" -Value $calendarstats.FolderAndSu bfolderSiz e
$report += $mbObj
}
$mailboxes = @(Get-Mailbox <user>)
$report = @()
foreach ($mailbox in $mailboxes)
{
$inboxstats = Get-MailboxFolderStatistic
$deletedstats = Get-MailboxFolderStatistic
$sentitemstats = Get-MailboxFolderStatistic
$calendarstats = Get-MailboxFolderStatistic
Write-Host "Getting Stats for " $mailbox.DisplayName -ForegroundColor Green
$mbObj = New-Object PSObject
$mbObj | Add-Member -MemberType NoteProperty -Name "Display Name" -Value $mailbox.DisplayName
$mbObj | Add-Member -MemberType NoteProperty -Name "Inbox Size (Mb)" -Value $inboxstats.FolderandSubFo
$mbObj | Add-Member -MemberType NoteProperty -Name "Deleted Items(MB)" -Value $deletedstats.FolderAndSub
$mbObj | Add-Member -MemberType NoteProperty -Name "Sent Items(MB)" -Value $sentitemstats.FolderAndSu
$mbObj | Add-Member -MemberType NoteProperty -Name "Calendar(MB)" -Value $calendarstats.FolderAndSu
$report += $mbObj
}
ASKER
I did not get an error, however the output looks like this for the tested 46
"Display Name","Inbox Size (Mb)","Deleted Items(MB)","Sent Items(MB)","Calendar(MB)"
"<lastname>, <firstname>",,,,
where as for my user account I get this
"Display Name","Inbox Size (Mb)","Deleted Items(MB)","Sent Items(MB)","Calendar(MB)"
"<lastname>, <firstname>","53.53 MB (56,134,463 bytes)","15.87 MB (16,644,152 bytes)","18.74 MB (19,652,660 bytes)","788.4 KB (807,296 bytes)"
"Display Name","Inbox Size (Mb)","Deleted Items(MB)","Sent Items(MB)","Calendar(MB)"
"<lastname>, <firstname>",,,,
where as for my user account I get this
"Display Name","Inbox Size (Mb)","Deleted Items(MB)","Sent Items(MB)","Calendar(MB)"
"<lastname>, <firstname>","53.53 MB (56,134,463 bytes)","15.87 MB (16,644,152 bytes)","18.74 MB (19,652,660 bytes)","788.4 KB (807,296 bytes)"
seems those blank values were the cause of the errors, your script is perfect, since the values are not returning proper values hence the error.
Can you check why is the script failing to get the values for these 46 users, are they valid etc., etc.,
Can you check why is the script failing to get the values for these 46 users, are they valid etc., etc.,
ASKER
That is what my question is. why is my script failing for some users. I can run this command for example on failing users
Get-MailboxFolderStatistic s <user> -FolderScope Inbox | Select FolderSize
and get results. Here is the results of the user that returned ",,,," with my script.
FolderSize
----------
4.262 GB (4,576,711,674 bytes)
637.1 MB (668,038,840 bytes)
36.81 MB (38,598,161 bytes)
Get-MailboxFolderStatistic
and get results. Here is the results of the user that returned ",,,," with my script.
FolderSize
----------
4.262 GB (4,576,711,674 bytes)
637.1 MB (668,038,840 bytes)
36.81 MB (38,598,161 bytes)
Dump
Get-MailboxFolderStatistics <user> -FolderScope Inbox | Select FolderPath, FolderSize
for a failing user because the folder path is the culprit for sure.
ASKER
PS C:\Users\server> Get-MailboxFolderStatistic s <user> -FolderScope Inbox | Select FolderPath, FolderSize
FolderPath FolderSize
---------- ----------
/foldername 4.27 GB (4,585,222,849 bytes)
/foldername 637.1 MB (668,038,840 bytes)
/foldername 36.81 MB (38,598,161 bytes)
FolderPath FolderSize
---------- ----------
/foldername 4.27 GB (4,585,222,849 bytes)
/foldername 637.1 MB (668,038,840 bytes)
/foldername 36.81 MB (38,598,161 bytes)
Is that really the result? Three folders with the same name?
ASKER
I guess it might help to have the folder name listed
PS C:\Users\server> Get-MailboxFolderStatistic s <user> -FolderScope Inbox | Select FolderPath, FolderSize
FolderPath FolderSize
---------- ----------
/Bandeja de entrada 4.27 GB (4,585,222,849 bytes)
/DELIA 637.1 MB (668,038,840 bytes)
/ZZZ - Varios 36.81 MB (38,598,161 bytes)
PS C:\Users\server> Get-MailboxFolderStatistic
FolderPath FolderSize
---------- ----------
/Bandeja de entrada 4.27 GB (4,585,222,849 bytes)
/DELIA 637.1 MB (668,038,840 bytes)
/ZZZ - Varios 36.81 MB (38,598,161 bytes)
There is no Inbox folder, so $inboxstats will be $null. I assume the same applies to the other default folders. Is that a resource mailbox, or maybe a archive mailbox? What's special about it?
ASKER
So interesting find. I have been through about 12 of the 46 and they are in Spanish so they have "Bandeja de entrada" which means Inbox in Spanish and "Elementos enviados" for sent "Elementos eliminados" for deleted and "Calendario" for calendar.
I just tried this modified line and it works.
Get-MailboxFolderStatistic s <user> -FolderScope Inbox | Where {$_.FolderPath -eq "/Bandeja de entrada"}
Can you help me with best practice coding that would try the Spanish version if it sees the null error? or if you have a better way I'm all ears!
I just tried this modified line and it works.
Get-MailboxFolderStatistic
Can you help me with best practice coding that would try the Spanish version if it sees the null error? or if you have a better way I'm all ears!
Would you like to get a clever&smart approach, or something more easy to understand?
ASKER
Well honestly I would like both because I am trying to learn, but I don't want to waste your time so I if I had to chose one I will go with the easy to understand...
"Easy" one, with some optimizations.
$mailboxes = @(Get-Mailbox <username>)
$report = @()
foreach ($mailbox in $mailboxes)
{
$mbstat = Get-MailboxFolderStatistics $mailbox
$inboxstats = $mbstat | Where {$_.FolderPath -in "/Inbox" , "/Bandeja de entrada" }
$deletedstats = $mbstat | Where {$_.FolderPath -in "/Deleted Items", "/Elementos eliminados" }
$sentitemstats = $mbstat | Where {$_.FolderPath -in "/Sent Items" , "/Elementos enviados" }
$calendarstats = $mbstat | Where {$_.FolderPath -in "/Calendar" , "/Calendario" }
Write-Host "Getting Stats for " $mailbox.DisplayName -ForegroundColor Green
$report += New-Object PSObject -Property @{
"Display Name" = $mailbox.DisplayName
"Inbox Size (Mb)" = $inboxstats .FolderandSubFolderSize / 1mb
"Deleted Items(MB)" = $deletedstats .FolderAndSubfolderSize / 1mb
"Sent Items(MB)" = $sentitemstats.FolderAndSubfolderSize / 1mb
"Calendar(MB)" = $calendarstats.FolderAndSubfolderSize / 1mb
}
}
More clever:$report = @()
foreach ($mailbox in Get-Mailbox <username>)
{
$mbstat = Get-MailboxFolderStatistics $mailbox
$stats = @()
foreach ($mbs in (("/Inbox" , "/Bandeja de entrada" ),
("/Deleted Items", "/Elementos eliminados"),
("/Sent Items" , "/Elementos enviados" ),
("/Calendar" , "/Calendario" ))
{
$stats += $mbstat | ? { $_.FolderPath -in $mbs } | Select -Expand FolderAndSubFolderSize
}
Write-Host "Getting Stats for " $mailbox.DisplayName -ForegroundColor Green
$report += New-Object PSObject -Property @{
"Display Name" = $mailbox.DisplayName
"Inbox Size (Mb)" = $stats[0] / 1mb
"Deleted Items (MB)" = $stats[1] / 1mb
"Sent Items (MB)" = $stats[2] / 1mb
"Calendar (MB)" = $stats[3] / 1mb
}
}
ASKER
Hmm, so I get errors with both of them :-/ let me take your easier one first. Im going to add "-ResultSize Unlimited" and "$report | Export-Csv c:\Temp\Reportvdimas.csv -NoTypeInformation"
$mailboxes = @(Get-Mailbox -ResultSize Unlimited)
$report = @()
foreach ($mailbox in $mailboxes)
{
$mbstat = Get-MailboxFolderStatistic s $mailbox
$inboxstats = $mbstat | Where {$_.FolderPath -in "/Inbox" , "/Bandeja de entrada" }
$deletedstats = $mbstat | Where {$_.FolderPath -in "/Deleted Items", "/Elementos eliminados" }
$sentitemstats = $mbstat | Where {$_.FolderPath -in "/Sent Items" , "/Elementos enviados" }
$calendarstats = $mbstat | Where {$_.FolderPath -in "/Calendar" , "/Calendario" }
Write-Host "Getting Stats for " $mailbox.DisplayName -ForegroundColor Green
$report += New-Object PSObject -Property @{
"Display Name" = $mailbox.DisplayName
"Inbox Size (Mb)" = $inboxstats .FolderandSubFolderSize / 1mb
"Deleted Items(MB)" = $deletedstats .FolderAndSubfolderSize / 1mb
"Sent Items(MB)" = $sentitemstats.FolderAndSu bfolderSiz e / 1mb
"Calendar(MB)" = $calendarstats.FolderAndSu bfolderSiz e / 1mb
}
}
$report | Export-Csv c:\Temp\Reportvdimas.csv -NoTypeInformation
I get this error
You must provide a value expression on the right-hand side of the '-' operator.
At line:4 char:52
+ $inboxstats = $mbstat | Where {$_.FolderPath - <<<< in "/Inbox" , "/Bandeja de entrada" }
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordE xception
+ FullyQualifiedErrorId : ExpectedValueExpression
$mailboxes = @(Get-Mailbox -ResultSize Unlimited)
$report = @()
foreach ($mailbox in $mailboxes)
{
$mbstat = Get-MailboxFolderStatistic
$inboxstats = $mbstat | Where {$_.FolderPath -in "/Inbox" , "/Bandeja de entrada" }
$deletedstats = $mbstat | Where {$_.FolderPath -in "/Deleted Items", "/Elementos eliminados" }
$sentitemstats = $mbstat | Where {$_.FolderPath -in "/Sent Items" , "/Elementos enviados" }
$calendarstats = $mbstat | Where {$_.FolderPath -in "/Calendar" , "/Calendario" }
Write-Host "Getting Stats for " $mailbox.DisplayName -ForegroundColor Green
$report += New-Object PSObject -Property @{
"Display Name" = $mailbox.DisplayName
"Inbox Size (Mb)" = $inboxstats .FolderandSubFolderSize / 1mb
"Deleted Items(MB)" = $deletedstats .FolderAndSubfolderSize / 1mb
"Sent Items(MB)" = $sentitemstats.FolderAndSu
"Calendar(MB)" = $calendarstats.FolderAndSu
}
}
$report | Export-Csv c:\Temp\Reportvdimas.csv -NoTypeInformation
I get this error
You must provide a value expression on the right-hand side of the '-' operator.
At line:4 char:52
+ $inboxstats = $mbstat | Where {$_.FolderPath - <<<< in "/Inbox" , "/Bandeja de entrada" }
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordE
+ FullyQualifiedErrorId : ExpectedValueExpression
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Yeah, The change management process here is pretty crazy. an upgrade is in the works but it could be months..... So I tried your new version and get this error
Unexpected token '.FolderandSubFolderSize' in expression or statement.
At line:11 char:64
+ "Inbox Size (Mb)" = $inboxstats .FolderandSubFolderSize <<<< / 1mb
+ CategoryInfo : ParserError: (.FolderandSubFolderSize:S tring) [], ParentContainsErrorRecordE xception
+ FullyQualifiedErrorId : UnexpectedToken
Ah, but using my noob common sense I removed the extra spaces and it is working :D wahoo!! I slowly walked through the code and it looks pretty straight forward as far as what its doing. This easier code is a lot better then what I was getting into! Thank you so much for the help, I really appreciate it!
Unexpected token '.FolderandSubFolderSize' in expression or statement.
At line:11 char:64
+ "Inbox Size (Mb)" = $inboxstats .FolderandSubFolderSize <<<< / 1mb
+ CategoryInfo : ParserError: (.FolderandSubFolderSize:S
+ FullyQualifiedErrorId : UnexpectedToken
Ah, but using my noob common sense I removed the extra spaces and it is working :D wahoo!! I slowly walked through the code and it looks pretty straight forward as far as what its doing. This easier code is a lot better then what I was getting into! Thank you so much for the help, I really appreciate it!
Ooops, sorry about the spaces, I never can remember in which language they are allowed or not :/.
Add-Member -MemberType NoteProperty -Name "Inbox Size (Mb)" -Value $inboxstats.FolderandSubFo
Size.ToMB
by
Add-Member -MemberType NoteProperty -Name "Inbox Size (Mb)" -Value $inboxstats.FolderandSubFo
Size / 1mb