Comparing AD group membership for two or more users (role-based security)

This one builds a dynamic array in two dimensions. It first iterates through all of the users, identifying all of the unique AD groups that contain at least one of the users. It then builds the array dynamically, for each group identifying which of the users are a member of the group.
The end output is a table of all of the group memberships in a format where a manager can easily compare group memberships for multiple people with given roles to make sure that they all have the appropriate security memberships.
The use case here is primarily for transitioning from ad-hoc security memberships to role-based security memberships.

As before, this works very well with the excellent ImportExcel module mentioned in the Scripting Guys blog, and available from the PowerShell Gallery.

You would use a command line like this:
.\Get-UserGroupMatrix.ps1 -SamAccountName user1,user2,user3 | Export-Excel -path c:\temp\groupreport-role.xlsx -TableName role -TableStyle Medium13 -AutoSize

Finding the sizes for subfolders in a parent folder

I came up with this to find the sizes of each subfolder (one level) in a parent folder. The primary use case is figuring out which users are using excessive amounts of space in their personal folders on a network share, but it’s not limited to that.
This will end up with data suitable for discussing with people (because most of the GUI tools give me pretty pictures, but aren’t really designed for sharing the results with your line manager or the individual users when you have the conversation about cleaning house).

It will report the size both in bytes (for sorting) and in GB/MB/KB/bytes (for ease of communicating), and will also identify the single largest file in each of the subfolders. Useful for when someone has zipped up their entire user folder on their computer and uploaded it to their personal folder…

Note that this works very well with the excellent ImportExcel module mentioned in the Scripting Guys blog, and available from the PowerShell Gallery.

In this case, you would use a command line like this:
.\Get-FolderSize.ps1 -path \\Server\Share\Path | Export-Excel -path c:\temp\pathreport.xlsx -TableName path -TableStyle Medium13 -AutoSize