Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ConvertTo-Gb : Cannot process argument transformation on parameter 'size'. Cannot convert value to type System.String. #27

Closed
KeithwNZ opened this issue Jan 11, 2024 · 0 comments

Comments

@KeithwNZ
Copy link

In some cases
$sentItems = Get-EXOMailboxFolderStatistics -Identity $.UserPrincipalName -Folderscope sentitems_
returns details for additional folders and not only the Sent Items folder, resulting in the error as per title of this issue.

It can be corrected (and I have successfully tested) by qualifying using "| Where {$_.FolderPath -eq "/Sent Items"} ", as follows.

Replace

$sentItems = Get-EXOMailboxFolderStatistics -Identity $.UserPrincipalName -Folderscope sentitems | Select-Object ItemsInFolderAndSubfolders,@{Name = "sentItemSize"; Expression = {$.FolderAndSubfolderSize.ToString().Split("(")[0]}}

with

$sentItems = Get-EXOMailboxFolderStatistics -Identity $.UserPrincipalName -Folderscope sentitems | Where {$_.FolderPath -eq "/Sent Items"} | Select-Object ItemsInFolderAndSubfolders,@{Name = "sentItemSize"; Expression = {$.FolderAndSubfolderSize.ToString().Split("(")[0]}}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant