Office 365 – Shared Mailbox – Sent email not saving in shared “Sent Items”

Shared mailboxes migrated just fine into Office 365 (Exchange Online) shared mailboxes.  Users that are able to send email on behalf of the shared mailbox are having the sent email copy stored in the “Sent Items” of the sender as opposed to the “Sent Items” of the shared mailbox.  All the people who share use of the shared mailbox would like to be able to see sent email by others using the  shared mailbox.

Microsoft decided that this should be an ability of Exchange Online, but did not set that behavior by default. Please refer to this TechNet article for more details on how to set this behavior.

I needed a script that would be able to march through all the shared mailboxes and make the change.  Here’s the script:

$sharedMailboxCollection = Get-Mailbox -Filter {RecipientTypeDetails -eq 'SharedMailbox'}
foreach ($mailBox in $sharedMailboxCollection)
 set-mailbox $mailBox.UserPrincipalName -MessageCopyForSentAsEnabled $True
 set-mailbox $mailBox.UserPrincipalName -MessageCopyForSendOnBehalfEnabled $True

Setting permissions on home drive folders

Scenario: Home drives were initially shared out on a Linux based NAS appliance.  The device fails, but the data remains intact. The data is recovered using a file copy utility.  The data is recovered… Yay!  All the NTFS-like file permissions are gone… 🙁

By the way, here’s a really good blog that details the required NTFS permissions for user home drives:

Automatic creation of user folders for home, roaming profile and redirected folders.

I get to fix these sorts of things!  Welcome to my world!

Now, I need to iterate through all of the folders and set them for each individual user.  Doing through the NTFS permissions GUI for each one is a Systems Administrator’s purgatory.  Needless to say, I’m not going to do that.  Wouldn’t it be better to script that?  I see a bunch of virtual heads nodding and I agree.

I’m going to do it using PowerShell module that was created by Raimund Andree.  Thank God for that cat!  You can get the module here:

More details on how to use the module to manage NTFS permissions can be found here:

$userFolderPath = "E:\User\"
$folders = Get-ChildItem $userFolderPath
foreach ($folder in $folders)
    $ADUser = Get-ADUser -Filter {Enabled -eq  $true -and SamAccountName -eq $folder.Name} -Properties CanonicalName
    if (-Not ($ADUser -eq $null))
        $domain = $ADUser.CanonicalName.Substring(0,$ADUser.CanonicalName.IndexOf("."))
        $userSecurityPrincipal = $domain + "\" + $ADUser.SamAccountName
        $userFolder = $userFolderPath + $folder
        $userSecurityPrincipal + " => " + $userFolder
        Add-NTFSAccess -Path $userFolder -Account $userSecurityPrincipal -AccessRights FullControl

Creating home drive folders for users without one

Of course I know that one can use the “Home folder” option in the Profile of the user in Active Directory.  Due to certain constraints of a situation I inherited, that’s really not an option for now.

I need to do it in bulk, for a bunch of active user accounts within a specific OU.  Additionally, I don’t know if the user has a folder or not.  Nor do I feel like waiting for these users to login and then have the folder created.

Luckily for me, I have a ton of storage and a single location for user home folders.  I simply want to walk through all the users in a specific OU, like “…this\path\to\my\ou\…”  If the folder does not exist, then go ahead and create it.

$homePath = "Q:\UserHome\"
$userHome = get-aduser -filter {enabled -eq $true} -properties SamAccountName,CanonicalName
foreach ($ADUser in $userHome)
  if ($ADUser.CanonicalName -like '*/myOu/Path/*')
    $userHomePath = $homePath + $ADUser.SamAccountName
    if (-Not (Test-Path $userHomePath))
      New-Item $userHomePath -Type Directory

Remove home drive folders for inactivated users

I ran into an challenge where there were tons of home folders for users that may or may not be active.  The folders were named according to the User ID used to login to user workstations.  In Active Directory, this was known as SamAccountName.

Going through Active Directory to find each user’s SamAccountName and then see if there’s a corresponding home drive folder would be tedious at best.  So, there must be a better way!

Here’s a script that will iterate through all the user folders in the “E:\User” folder and then remove deactivated user folders to the “E:\DeletedHomeDirectories” folder to be dealt with later.

<# RemoveFoldersWithoutUsers.ps1
By Frank Contreras
Use at your own risk
$folders = Get-ChildItem "G:\UserShare\"
foreach ($folder in $folders) 
  $ADUser = Get-ADUser -Filter {Enabled -eq $true -and SamAccountName -eq $folder.Name}
  if ($ADUser -eq $null)
    "Removing " + $folder
    $source = "G:\UserShare\"+$folder
    $destination = "E:\DeletedHomeDirectories\" + $folder.Name
    Move-Item -Path $source -Destination $destination

Managing N-able agent on Mac

Starting and stopping the agent
The Mac OS X agent is started automatically during the system boot process. The operating system will ensure that the agent is restarted automatically in the event that it crashes or is killed. If necessary, it can be started and stopped manually using the launchctl utility.

To start or stop the agent processes using the launchctl utility, follow the following procedure:

As an administrator, open a terminal window and run the launchctl command:

sudo launchctl

Enter your login password when prompted.

To start the agent, enter the following:

load /Library/LaunchDaemons/com.n-able.agent-macosx.plist

To stop the agent, enter the following:

unload /Library/LaunchDaemons/com.n-able.agent-macosx.plist

Quit launchctl by typing control-d.

Viewing agent logs
The agent writes logging information to “/var/log/N-able/N-agent/nagent.log”. The operating system will rotate this log daily and will retain only the previous five days of log files.

Uninstalling the agent
To uninstall the agent, log in as an administrator user. Open a terminal window and run the following command:

sudo /Applications/

NOTE: Uninstalling the agent by dragging the N-agent application folder to the trash is not recommended. This method of uninstalling the agent will fail if the agent is running and will not remove the launchd service startup files from /Library/LaunchDaemons.

Configure network settings on a new CentOS 7 server

  1. use the nmtui to configure the network connection.  Define the netmask in the ip address.
     Ex. or
  2. Restart the network services for changes to take place:
    systemctl restart network.service.
  3. To be able to use the ifconfig command, install the net-tools
    yum -y install net-tools
  4. To be able to use the nslookup command, install the bind-utils
    yum -y install bind-utils
  5. Update the build
    yum -y update

SimpleSAMLphp setup on Windows 2008 – Install PHP

The application runs on PHP, so it will need to be installed on the server for Windows to run the scripts.
You should be able to go here for the latest PHP installer for IIS:
Use the Web Platform Installer to automate the installation and configuration of PHP on your server.  You could do it manually, but it’s a pain.  The installer should be able to be found here;
Version 5.6.0 was used at the time of this writing.
Find the version of PHP you want to install and click the Add button.  Example: PHP 5.6.0.
If dependent components are missing, they will be listed to be included with the PHP installation.  Go ahead and click the “I Accept” button.
After the installation completes, you’ll be presented with a summary page of the pieces that were installed.  Click on Finish.
Use PHP Manager in IIS Manager to finish configuring PHP:
Set recommendations for adding index.php to default file and automatically reset php when config.php is updated.  Click on the “View recommendations.” link.
Click on the “Enable or disable and extension” link.
Use “Enable or disable and extension” to drill down and enable LDAP Extension:
LDAP will be the protocol used by SimpleSAMLphp to get user information from Active Directory when authenticating.
Next we will look at installing the SimpleSAMLphp application.

Set JAVA_HOME on Linux

How to set $JAVA_HOME variable on Linux

Article based on:

  • Linux Mint 14
  • Java 1.7

Should work on any Linux and Java version: Ubuntu, RedHat, CentOS, SUSE, ArchLinux, Debian, Fedora etc.

1. Install Java

If you have already installed Java then skip to point 3.

Before continue make sure you don’t have installed Java.

Open terminal and invoke:

whereis java

command. If you do not have Java then you will see:


That will mean you DONT have Java.

Download Java from here or use your package manager to install it.

2. Java location

By default Java is located in



3. Set $JAVA_HOME variable

To set JAVA_HOME only in actual shell session, invoke command:

export JAVA_HOME=/usr/lib/jvm/java-<version>

To persist this environment variable edit vi ~/.bash_profile file, and add JAVA_HOME definition:


Save and relogin to apply changes.

Install phpMyAdmin

phpMyAdmin is a tool written in PHP intended to handle the administration of MySQL over the Web. Visit the phpMyAdmin website for more information.
At the terminal, enter the following:
Elevate to root access

su -

Install phpMyAdmin

yum install phpmyadmin

Change the the /etc/httpd/conf.d/phpMyAdmin.conf  file to allow remote administration:

#Order Allow,Deny 
#Deny from all
Allow from

Restart the apache server

service http restart

From a browser, go to


Career and Professional Website