{"id":90,"date":"2011-08-15T13:00:00","date_gmt":"2011-08-15T13:00:00","guid":{"rendered":"\/post\/2011\/08\/15\/List-activesync-device-statistics.aspx"},"modified":"2011-08-15T13:00:00","modified_gmt":"2011-08-15T13:00:00","slug":"list-activesync-device-statistics","status":"publish","type":"post","link":"https:\/\/www.vatland.no\/index.php\/list-activesync-device-statistics\/","title":{"rendered":"List activesync device statistics"},"content":{"rendered":"<p>Some times it is usefull to get a list of when did devices last sync.<\/p>\n<p>get-mailbox | ForEach-Object { Get-ActiveSyncDeviceStatistics -Mailbox $_.Identity;}| Out-File -filepath c:\\powershell\\activesync.txt<\/p>\n<p>Or if you want to list spesific devices:<\/p>\n<p>get-mailbox | ForEach-Object { Get-ActiveSyncDeviceStatistics -Mailbox $_.Identity;}|where {$_.devicefriendlyname -eq &#8220;Touch_DUal&#8221;}| Out-File -filepath c:\\powershell\\activesync.txt<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Some times it is usefull to get a list of when did devices last sync. get-mailbox | ForEach-Object { Get-ActiveSyncDeviceStatistics -Mailbox $_.Identity;}| Out-File -filepath c:\\powershell\\activesync.txt Or if you want to list spesific devices: get-mailbox | ForEach-Object { Get-ActiveSyncDeviceStatistics -Mailbox $_.Identity;}|where {$_.devicefriendlyname -eq &#8220;Touch_DUal&#8221;}| Out-File -filepath c:\\powershell\\activesync.txt &nbsp;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[5],"tags":[],"class_list":["post-90","post","type-post","status-publish","format-standard","hentry","category-exchange"],"aioseo_notices":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_likes_enabled":false,"jetpack-related-posts":[{"id":765,"url":"https:\/\/www.vatland.no\/index.php\/list-exchange-mailboxes-with-forwarding-rules\/","url_meta":{"origin":90,"position":0},"title":"List Exchange mailboxes with forwarding rules","author":"Atle","date":"May 4, 2018","format":false,"excerpt":"Simple list of all mailboxes and rules. Displays more info if one of them contains a forwarding rule:","rel":"","context":"In &quot;Exchange&quot;","block_context":{"text":"Exchange","link":"https:\/\/www.vatland.no\/index.php\/category\/exchange\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":82,"url":"https:\/\/www.vatland.no\/index.php\/check-server-accounts-in-active-directory\/","url_meta":{"origin":90,"position":1},"title":"Check server accounts in Active Directory.","author":"Atle","date":"October 26, 2011","format":false,"excerpt":"I made a simple powershell to list server accounts in AD, list versions and service pack level. It will also do a simple test-connection to see if it is alive (remember 2008 firewall will block icmp by default. Import-Module activedirectory$htmlheader = \"<html><head><\/head><body><table>\"$trtdstart =\"<tr><td>\"$trtdstart3 =\"<tr bgcolor=#80ff80><td>\"$trtdstart1 =\"<tr bgcolor=#40FF00><td>\"$trtdstart2 =\"<tr bgcolor=#FF8080><td>\"$tdstart =\"<td>\"$tdstartstop=\"<\/td><td>\"$tdend=\"<\/td>\"$trtdend\u2026","rel":"","context":"Similar post","block_context":{"text":"Similar post","link":""},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":934,"url":"https:\/\/www.vatland.no\/index.php\/simple-powershell-mru-list\/","url_meta":{"origin":90,"position":2},"title":"Simple Powershell MRU list","author":"Atle","date":"December 23, 2019","format":false,"excerpt":"When using using my secret server powershell functions I got tired of constantly searching for secret ID's. I had to do a new search just because I could not remember the ID's. So I added some kind of MRU to my get-secretID function. This code block creates to classes mruitem\u2026","rel":"","context":"In &quot;Powershell&quot;","block_context":{"text":"Powershell","link":"https:\/\/www.vatland.no\/index.php\/category\/powershell\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":68,"url":"https:\/\/www.vatland.no\/index.php\/script-to-delete-files-older-thans-x-days\/","url_meta":{"origin":90,"position":3},"title":"Script to delete files older thans x days","author":"Atle","date":"June 4, 2012","format":false,"excerpt":"This script will delete files older than 10 days. $Now = Get-Date$LastWrite = $Now.AddDays(-10)$Files = get-childitem -Path \"C:\\folder_with_files_to_delete\" |Where {$_.CreationTime -le $LastWrite} foreach ($File in $Files){Remove-Item -Path $File -Force} Save this script as \"c:\\scripts\\deleteoldfiles.ps1\" In schedule task select program\/script to run : \"C:\\WINDOWS\\system32\\WindowsPowerShell\\v1.0\\powershell.exe\" and use : -command \"c:\\scripts\\deleteoldfiles.ps1\" as argument\u2026","rel":"","context":"In &quot;Categories&quot;","block_context":{"text":"Categories","link":"https:\/\/www.vatland.no\/index.php\/category\/categories\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":367,"url":"https:\/\/www.vatland.no\/index.php\/exchange-server-quarantined-a-mailbox\/","url_meta":{"origin":90,"position":4},"title":"Exchange server quarantined a mailbox.","author":"Atle","date":"November 11, 2014","format":false,"excerpt":"One user tried to run an attachment in a newly received email \u00a0. After this his mailbox became inaccessible. When he tried to access it\u00a0using OWA the familiar message appeared\u00a0: Something went wrong. My first thought was that the database was dismounted, but other mailboxes on the same database still\u2026","rel":"","context":"Similar post","block_context":{"text":"Similar post","link":""},"img":{"alt_text":"exchange","src":"https:\/\/i0.wp.com\/www.vatland.no\/wp-content\/uploads\/2014\/09\/exchange.jpg?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":957,"url":"https:\/\/www.vatland.no\/index.php\/hash-tables-in-powershell\/","url_meta":{"origin":90,"position":5},"title":"Hash tables in powershell","author":"Atle","date":"March 23, 2020","format":false,"excerpt":"We all have the need to store data in some kind of arrays. I use hashtables a lot. Preferred use is as a lookup table, I can use 'contains' instead of looping through each item or reference an object by name instead of index number. Lookup table for licenses is\u2026","rel":"","context":"In &quot;CSP&quot;","block_context":{"text":"CSP","link":"https:\/\/www.vatland.no\/index.php\/category\/csp\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"https:\/\/www.vatland.no\/index.php\/wp-json\/wp\/v2\/posts\/90","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.vatland.no\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.vatland.no\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.vatland.no\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.vatland.no\/index.php\/wp-json\/wp\/v2\/comments?post=90"}],"version-history":[{"count":0,"href":"https:\/\/www.vatland.no\/index.php\/wp-json\/wp\/v2\/posts\/90\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.vatland.no\/index.php\/wp-json\/wp\/v2\/media?parent=90"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.vatland.no\/index.php\/wp-json\/wp\/v2\/categories?post=90"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.vatland.no\/index.php\/wp-json\/wp\/v2\/tags?post=90"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}