KAKA JI
asked on
Exchange
Powershell Script to get mailbox size in MB for list of users in a CSV file with only Samaccountname
ASKER
Thanks TimGreen7077
I need further help
I am getting this error
in : Unexpected token 'in' in expression or statement.
+ CategoryInfo : ParserError: (in:String) [], ParentContainsErrorRecordE xception
+ FullyQualifiedErrorId : UnexpectedToken
I need further help
I am getting this error
in : Unexpected token 'in' in expression or statement.
+ CategoryInfo : ParserError: (in:String) [], ParentContainsErrorRecordE
+ FullyQualifiedErrorId : UnexpectedToken
ASKER
[PS] C:\ProgramData\Microsoft\W indows\Sta rt Menu\Programs\Microsoft Exchange Server 2010>$userlist = Import-Csv "C:\spam\user.csv" foreach($user in $userlist){ Get-MailboxStatistics -Identity $user.SAMAccountName | select displayname, totalitemsize | Export-Csv "c:\spam\results.csv" }
in : Unexpected token 'in' in expression or statement.
+ CategoryInfo : ParserError: (in:String) [], ParentContainsErrorRecordE xception
+ FullyQualifiedErrorId : UnexpectedToken
in : Unexpected token 'in' in expression or statement.
+ CategoryInfo : ParserError: (in:String) [], ParentContainsErrorRecordE
+ FullyQualifiedErrorId : UnexpectedToken
Did you copy the last sentence of Tim's script also? That was instructional in nature and should not be run from the command line. Here it is separated:
You can run the following:
You can run the following:
$userlist = Import-Csv C:\temp\sizes.csv
foreach ($user in $userlist){
Get-MailboxStatistics -Identity $user.samaccountname | select displayname, totalitemsize | Export-Csv c:\temp\results.csv
}
In your csv file name the column 'samaccountname'
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Thanks @Jason for clarifying that for the user.
@Kaka tell me the name of your csv file and the version of exchange your are using and I will add it to the script for you.
@Kaka tell me the name of your csv file and the version of exchange your are using and I will add it to the script for you.
ASKER
Thanks Todd that worked just fine
$userlist = Import-Csv C:\temp\sizes.csv
foreach ($user in $userlist){
Get-MailboxStatistics -Identity $user.samaccountname | select displayname, totalitemsize | Export-Csv c:\temp\results.csv
}
In your csv file name the column 'samaccountname'