Making the Configuration Manager PowerShell Module Discoverable

I’m not going to ENABLE-RANT today.   Anybody that uses System Center Configuration Manager knows one thing, you need to MANUALLY add in the Cmdlets to use them using this line

Import-Module ‘C:\Program Files (x86)\Microsoft Configuration Manager\AdminConsole\bin\ConfigurationManager.psd1’

True, it’s irritating that I can just do something like this in a modern server

Import-Module ConfigurationManager

If this were there not only would it be EASIER to access the module locally, it would also allow me to create and establish Remote PowerShell sessions to EASILY work with Configuration Manager and make Implicit remoting far smoother.

But rather than get upset, I decided to sit down and find out why.  Why if I do THIS

Get-Module –listavailable ConfigurationManager

Does it NOT find the module?

The answer was surprisingly easy (and a bit silly it got missed by somebody)

For your module to be discoverable it needs to follow two rules

  1. The PSD1 file must be in a folder of the same name
  2. This Folder must be added to the System Environment variable “PSModulePath”

So examining my default PSModulePath on a Configuration Manager 1606 server It was DEFINITELY not there (yes, fully patched, rebooted multiple times)


C:\Users\Administrator.SYSTEMCTR\Documents\WindowsPowerShell\Modules;C:\Program Files\WindowsPowerShell\Modules;C:\Windows\system32\WindowsPowerShell\v1.0\Modules;C:\Program Files (x86)\Microsoft SQL Server\110\Tools\PowerShell\Modules\

So initially I thought I would just add it to the PSModulePath in the following fashion while in a PowerShell prompt as Administrator.

$ENV:PSModulePath=($ENV:PSModulePath) + ‘;C:\Program Files (x86)\Microsoft Configuration Manager\AdminConsole\bin\’

Tried that and looked and still nothing…. oh right forgot the FIRST rule

The PSD1 file must be in a folder of the same name

Our problem is that all of the needed files and content exist in the BIN folder and it needs to be renamed to ConfigurationManager.  But obviously we can’t do THAT or things will break.  

We COULD just make a copy of that folder called “ConfigurationManager” and add THAT to the path.  That might work too. But that offers up other scary words.

  • “Supportability” (Microsoft probably won’t support that)
  • “Patching” (If it DID work, we’d have to dupe that folder EACH and EVERY TIME we patched)
  • “Works?” (Moving supporting Binaries in ANY major application is just Ripe with Risk)

The it dawned on me.  Since VISTA (Stop cringing) we’ve had Junctions.   A Junction is a “Pseudo Folder” which ACTS like a Directory but points off to another Directory.

We COULD create a Junction called “ConfigurationManager” and point it RIGHT BACK to the folder with all of the goodies needed in the Configuration Manager module.

Well guess what… it works! Here’s the Script in PowerShell to make this useful for you as well.

# Create a Junction to act as a folder called “Configuration Manager” pointing to the
# ‘Bin’ folder which has the Actual Configuration Manager module
# This provides a “Pseudo Folder” to match the Module Name needed

$TargetFolder=’C:\Program Files (x86)\Microsoft Configuration Manager\AdminConsole\bin\’
$TargetPath=’C:\Program Files (x86)\Microsoft Configuration Manager\AdminConsole\PSModule\’

# Verify this has not been done yet, if it has go ahead
If (!(Test-Path “$($TargetPath)ConfigurationManager\”))
New-Item -ItemType Directory -Path $TargetPath –Force
CMD.EXE /C MKLINK /J “$($TargetPath)ConfigurationManager” $TargetFolder
# You can use this line INSTEAD of MKLINK if you are running
# PowerShell 5
#New-Item -ItemType Junction -Name ConfigurationManager -Value $TargetFolder -Path $TargetPath

# Permanently update the PSModulePath Environment variable
# With the parent path holding the Configuration Manager folder
# This will make it fully discoverable

$OldPSPath=(Get-ItemProperty -Path ‘Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment’ -Name PSModulePath).PSModulePath

# Verify this has not been done yet, if it has go ahead
IF (!($OldPSPath | Select-String -SimpleMatch “$($TargetPath)ConfigurationManager”))
Set-ItemProperty -Path ‘Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment’ -Name PSModulePath –Value $NewPSPath


Now I can just run Import-Module ConfigurationManager and Woohoo! I’m off to races!

I’ll post this to the Technet Gallery later on.

Share and Enjoy!

The Energized Tech
Honorary Scripting Guy

Resolving issues with slow Outbound mail to Office 365 in a Hybrid connection using a SmartHost or Internal Appliance

You may find that flow to Office 365 hosted users is slow after initial Hybrid Configuration.  But the answer is closer than you think and is only one Cmdlet away with Windows PowerShell.

The actual problem is the mail flow to Office 365 is slow because the connector is defaulting to using DNS for mail sending. In this scenario the server is either sending directly to an internal appliance (such as a Barracuda) or uses a Smarthost on the internet (Such as on SBS 2011 / SBS 2008) and in many SMB configurations.

Normally you would change the connector properties to point the exist SmartHost and the problem would be resolved.


What you will find in the connector created by DEFAULT with the Hybrid wizard is this does NOT solve the problem. You can see the actual problem when you view the connectors with the Get-SendConnector Cmdlet and view a full list of the properties.

Get-SendConnector -identity ‘SmartHost Connector’ | Format-List *


Get-SendConnector -identity ‘Outbound to Office365’ | Format-List *


Note the highlighted areas of the Office 365 connector. By default it’s insistent on a TLS connection and a few additional properties (which are fine if you’re hosting a live Exchnage/DNS configuration)

However in the case of a SmartHost, it may not like this (Bad Smarthost on the internet with lousy Authentication ?) or you’re running an internal box to handle outbound spam which is not configured to accept TLS internally.

Three options you have. (as Yoda would say)

  1. One, get a better SmartHost provider or improve your internal Device security to accept TLS.
  2. The Second option is to recreate the Office 365 Connector from scratch with the same settings and point straight to the SmartHost.
  3. The third (and probably quite a bit easier) is to adjust the connector through PowerShell and disable the requirement for TLS and remove the additional properties left behind by Office 365’s Hybrid wizard (which should be fine for INTERNAL devices)

First make a copy of the Connector should you need to Rollback the process

Get-SendConnector -identity ‘Outbound to Office365’ | Export-Clixml Office365Connector.xml

Then adjust the particular connector name for Office 365 outbound mailflow on your On Premise Exchange environment

Set-SendConnector -identity ‘Outbound to Office365’ -RequireTLS $False -RequireTLS $False -TlsAuthLevel $NULL -TlsDomain $NULL -ErrorPolicies Default

No restart of any services are required and the effect should be immediate. Note as always, any mail stuck in the queue under the old configuration is just good for one thing… NDR’s 😉



The EnergizedTech

Migrating One Note Content from OneDrive (SkyDrive)

Today’s little share is not “PowerShell related” but it’s something I personally encountered and I thought it would be good to share.  I’ve been using OneDrive for a LONG time and when I started using One Note, it defaulted to my OneDrive account.  

This was really cool because the content kept synching, was always accessible remotely or locally.

As I started working for my current employer, I used it to keep track of rough notes on work for various clients.    One challenge however.

It was still on my Personal OneDrive.   I wanted to move my Corporate work to either a Central Sharepoint location or at LEAST to my One Drive for Business.

Here’s the problem I hit against.

If you go to OneDrive and click on the “One Note Notebook” in question there is NO download option.  (Most other documents you usually get that)


The answer is actually pretty simple.  I ran across in the Answers forum on Technet

Create a New Folder in OneDrive (I called my New OneNotes)



Move the One Note document to the Folder



Download the Newly created Folder


At this point once you click on download your browser will want to store away this as a ZIP file.   Store this away to a convenient location for later use.

Now you can have a copy.  Extract the contents of this zip file to a folder and copy the folder to your target location.  It can be

  • Local folder
  • File Share
  • One Drive for Business folder
  • Sharepoint Documents folder

Once you have copied the data to the Target location, you’ll need to open it at least Once for One Note to add to the list of Note Books.   In One Note 2016 just click on “File” and then “Open”


from this point there is a browser for navigating your various file locations.  Navigate to the new one, select your folder in question, then open the “Open Notebook” file just underneath the name of the folder.


Sometimes One Note may prompt you with a message like “A notebook cannot be found at this location.  Do you want to open …..” just click yes.   It’s nothing bad.

At this point you are now looking at your copy of the One Note document.  But you need to switch it from “Archive” to live.    You can tell from the above warning.


Click on the pretty yellow line to continue forward and allow the conversion to occur.  It will prompt you to Convert a Single Selection or the Entire Notebook.  In my case I’d like to convert the Entire Notebook


The process will step through all of your individual sections and convert them up to your modern version of One Note.   At this point you have now made a copy of your PERSONAL One Drive to your Business folder.    From here you can go through and delete sections and content that are yours and leave your business data behind for work.

Also note, this is a COPY.  If you MESSED up? (Oh … oh that just NEVER happens with computers …. Right?  Right? Nudge nudge) . 

Just remember you have a ZIP file you downloaded before.

Share and Enjoy!

The Energized Tech