Over the years I’ve seen and used a variety of PowerShell commands to get the ConfigurationManager.psd1  file location to pass to Import-Module

Just for fun, I compiled a list of the different methods.  It’s all about string manipulation.

When using a ConfigMgr cmdlet it is necessary to work from the ConfigMgr site’s drive.  I’ve also seen a variety of ways to accomplish this as detailed below.

When more than one ConfigMgr site is registered on a computer, it may be necessary to more specifically identify it.  This is one example.

Lastly, note the difference between the *-Location  cmdlets.  Using Push/Pop-Location allows changing to the ConfigMgr site drive before running the cmdlets then returning to the previous location afterward.

Push-Location and the alias pushd.

Pop-Location  and the alias popd.

Set-Location  and the aliases cd , chdir , and  sl.