{"id":262,"date":"2016-03-24T17:49:22","date_gmt":"2016-03-24T17:49:22","guid":{"rendered":"http:\/\/www.torontohelpdesk.ca\/blog\/?p=262"},"modified":"2016-03-24T17:58:13","modified_gmt":"2016-03-24T17:58:13","slug":"office-365-powershell-and-statistics","status":"publish","type":"post","link":"https:\/\/www.torontohelpdesk.ca\/blog\/office-365-powershell-and-statistics\/","title":{"rendered":"Office 365 &#8211; Powershell and Statistics"},"content":{"rendered":"<p><strong>Problem:<\/strong><\/p>\n<p>Doing Command Line work on Office 365. Side problem, getting statistics on on-line archive mailbox sizes.<\/p>\n<p><strong>Solution:<\/strong><\/p>\n<ol>\n<li>Load up Powershell on your PC (it usually comes installed, you just have to search for it)<\/li>\n<li>Run as Administrator<\/li>\n<li><span style=\"color: #0000ff;\">Set-ExecutionPolicy RemoteSigned<\/span> (only run this one per computer)<\/li>\n<li><span style=\"color: #0000ff;\">$UserCredential = Get-Credential<\/span><\/li>\n<li>Type in your credentials<\/li>\n<li><span style=\"color: #0000ff;\">$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https:\/\/outlook.office365.com\/powershell-liveid\/ -Credential $UserCredential -Authentication Basic -AllowRedirection<\/span><\/li>\n<li><span style=\"color: #0000ff;\">Import-PSSession $Session<\/span><\/li>\n<li>Check it by running get-mailbox and it should give you a result<\/li>\n<li>When you&#8217;re done, you must run\u00a0 <span style=\"color: #0000ff;\">Remove-PSSession $Session<\/span> otherwise you&#8217;ll have issues until the session times out<\/li>\n<\/ol>\n<p><em>Checking the mailbox size of your accounts:<\/em><\/p>\n<ol>\n<li><span style=\"color: #0000ff;\">get-mailbox | get-mailboxstatistics | ft displayname, totalitemsize<\/span><\/li>\n<\/ol>\n<p><em>Checking the mailbox size of your online Archive:<\/em><\/p>\n<ol>\n<li><span style=\"color: #0000ff;\">Get-Mailbox -Archive -ResultSize Unlimited | Get-MailboxStatistics -Archive | Sort-Object TotalItemSize -Descending | Select-Object DisplayName,TotalItemSize -First 100<\/span> (this pulls up the first 100, change it as you see fit)<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>Problem: Doing Command Line work on Office 365. Side problem, getting statistics on on-line archive mailbox sizes. Solution: Load up Powershell on your PC (it usually comes installed, you just have to search for it) Run as Administrator Set-ExecutionPolicy RemoteSigned <a class=\"more-link\" href=\"https:\/\/www.torontohelpdesk.ca\/blog\/office-365-powershell-and-statistics\/\">Continue reading <span class=\"screen-reader-text\">  Office 365 &#8211; Powershell and Statistics<\/span><span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,64,46],"tags":[107,108,99],"class_list":["post-262","post","type-post","status-publish","format-standard","hentry","category-office","category-office-365","category-powershell","tag-mailbox","tag-mailbox-size","tag-office-365"],"_links":{"self":[{"href":"https:\/\/www.torontohelpdesk.ca\/blog\/wp-json\/wp\/v2\/posts\/262","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.torontohelpdesk.ca\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.torontohelpdesk.ca\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.torontohelpdesk.ca\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.torontohelpdesk.ca\/blog\/wp-json\/wp\/v2\/comments?post=262"}],"version-history":[{"count":4,"href":"https:\/\/www.torontohelpdesk.ca\/blog\/wp-json\/wp\/v2\/posts\/262\/revisions"}],"predecessor-version":[{"id":266,"href":"https:\/\/www.torontohelpdesk.ca\/blog\/wp-json\/wp\/v2\/posts\/262\/revisions\/266"}],"wp:attachment":[{"href":"https:\/\/www.torontohelpdesk.ca\/blog\/wp-json\/wp\/v2\/media?parent=262"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.torontohelpdesk.ca\/blog\/wp-json\/wp\/v2\/categories?post=262"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.torontohelpdesk.ca\/blog\/wp-json\/wp\/v2\/tags?post=262"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}