The following is a simple script to generate a mailbox size report CSV for a set of email addresses. The full function and explanation follows.
Continue reading “PowerShell: Create a CSV Report of Mailbox Sizes”
Family, Cool Stuff and Assorted Geekery; the finer things in life. Updated when I have something interesting to write :)
The following is a simple script to generate a mailbox size report CSV for a set of email addresses. The full function and explanation follows.
Continue reading “PowerShell: Create a CSV Report of Mailbox Sizes”
Hi. Here’s another update on the Sync-Folder script here. In this part I add some more code to use literal paths (so that special characters don’t cause the sync to fail) and a report of the numbers of copies, updates, folder removals etc performed.
Update : I’ve revisited this script a few times with new additions and modifications.The latest full version of the script is here. That post also includes links covering the other revisions to the script. Continue reading “PowerShell: Synchronizing a Folder (and Sub-Folders) Part 6”
Before you start processing a bunch of Exchange objects sometimes you might want to check if they’re Mailboxes or RemoteMailboxes. The script (and explanation) is after the break. Continue reading “PowerShell: Is an Object a Mailbox or Remote-Mailbox?”
There’s a pretty simple way to test if something is a valid email address but it’s nice to wrap that around with a bit of code to test for a stream or array of values.
The function and explanation follows.Here’s the full function with an explanation (and alternative way to make it work) afterwards.
Continue reading “PowerShell: Check if an Email Address is Valid”Within Exchange (on-premise or Online) it’s sometimes helpful to export the delegate permissions that a user can set within their mailbox. Get-MailboxFolderPermission is the cmdlet which will export that information for a particular folder. The identifier needs to be in the format “john@contoso.com:\Marketing\Reports”.
That said there’s not an easy way to export the permissions on ALL folders within a mailbox and the output for that command isn’t very helpful for further processing.
So; script. It’ll take a mailbox as a parameter and output the permissions on all the mailbox folders (and subfolders) as objects.
I wrote a post about the initial version of the script and how it works in Part 1 here.
The first update, allowing the function to deal with special folders and the root better is here (Part 2).
I’ve also made the script stand-alone now (rather than a function). So just save this as a .ps1 file and run it with the MailboxToProcess parameter and it will work.
ie;
$MB=Get-Mailbox Ororo.Monroe
c:\scripts\path\New-FolderPermissionReportObjectArray.ps1 -MailboxToProcess $MB
Continue reading “PowerShell: Export All Exchange Mailbox Folder Permissions In A Format For Further Processing”
I’ve been using scripts that pass loads of custom objects back and forth as function parameters. In some cases these objects are built dynamically so they could have different properties on them.
It’s useful then to check if a particular set of parameters are on an object.
Hence; this function! (After the line!) Continue reading “PowerShell: Function to see if a Set of Properties Are on a Custom Object”
Hi. I wrote and ran a quick script to crawl a web-site and archive all it’s web-pages. It worked but I noticed some serious performance issues; its memory usage would occasionally balloon up to 19 GB (!); it would slow down occasionally and it just generally seemed inefficient.
So I had a think and came up with a better script with a few simple changes; it stays on about 500MB usage now and runs much better 🙂 Continue reading “PowerShell: Optimising a Scripts Performance (Archiving Web-Pages Script)”
With the outcry caused by the BBC removing the BBC food section from their website and the rush of people trying to mirror it or download the data I thought; just how would you do that with PowerShell?
(Of course, if you’re not interested in re-inventing the wheel Wget does this much better)
After a bit of thought I came up with the following requirements;
So a vague loop would be to go to a web page, go to all the links matching the sub page we want, output them to disk and record the page name to a list to make sure we don’t visit it again. You’d end up with a nice folder full of file versions of the website.
Invoke-WebRequest is good for this; it gets the web page content but also puts all the links from the page in a handy property of the object. Easy to enumerate through!
The script and detail are after the break.
Edit: I had another pass at this script and optimised it a bit here. Continue reading “PowerShell: Archiving All The Web-Pages on A Site (Example: bbc.co.uk/food)”
Hi. Last week a customer asked me find out which mailboxes had eaten all the pies on a particular Exchange server; getting a list of the largest mailboxes and whether they were in a disconnected state (already removed and waiting purge).
To get an accurate picture I needed to take into account the deleted items in the mailbox as well. It’s a small command but it’s got a few squirrelly bits I’ll go into as well after the line. Continue reading “PowerShell: Get Largest Mailboxes on an Exchange Server (One-Line Command)”
Often you need to record what a script does to a file. You can easily get something going with Start-Transcript but sometimes you want to control what is written with a bit more granularity.
So here’s a function I tend to re-use in my scripts. It takes text output and writes it both to a text log file and to the Verbose output stream. Continue reading “PowerShell: A Logging Function”