Exchange 2010 Add Mailbox Folder Permissions including Subfolders

I was asked by a user today for access to a specific folder in an old user’s mailbox within Outlook. There were no free computers and so the easy way out of setting up Outlook with the mailbox was not an option. I fired up Google and found this handy script for use in the Exchange Console:

ForEach($folder in (Get-MailboxFolderStatistics AliasofSharer| Where { $_.FolderPath.ToLower().StartsWith(“/Invoices“) -eq $True } ) )
{
$foldername = “AliasofSharer:” + $folder.FolderPath.Replace(“/”,”\”);
Add-MailboxFolderPermission $foldername -User AliasofRequestor-AccessRights PublishingEditor
}

  1. Change the name of the folder to be shared to where Invoices is here: ‘FolderPath.ToLower().StartsWith(“/Invoices“)’
  2. Change ‘AliasofSharer’ to the alias of the user who will be sharing the folder
  3. AliasofRequestor is who will be given access to said folder
  4. In the above example I’ve used PublishingEditor but this can be changed as required.

Adding Registry Entries With Powershell

Working at an MSP, I’ve been trying to script a lot of the repetitious tasks I have to do with Powershell. One of the smaller ones is hiding a local admin account on non domain computers.

Usually, I would have to navigate into the registry to HKEY_LOCAL_MACHINE\Software\Microsoft\WindowsNT\CurrentVersion\Winlogon and create a new key, called SpecialAccounts, and then another new key called UserList and then add a new dword value with the name of the account. That’s a lot of work!

Today, I fired up Google and Powershell ISE and came up with this simple, simple script:

New-Item -Path “HKLM:\Software\Microsoft\Windows NT\CurrentVersion\Winlogon” -Name SpecialAccounts –Force
New-Item -Path “HKLM:\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\SpecialAccounts” -Name UserList –Force
New-ItemProperty “HKLM:\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\SpecialAccounts\UserList” -Name “[LOCAL ACCOUNT NAME]” -Value 1 -PropertyType “DWord”

Saved it as a PS1 script file and ran it on my computer successfully.