Allow prevent autoload of CM psdrive
Rather than have to invoke PowerShell via the ConfigMgr console, I prefer to just load the module into my existing session/console.
The issue is that on load, the module auto-creates a PSDrvie with the CMSite provider using my current credentials.
This is an issue because my "normal" account has pretty limited rights in ConfigMgr (by design), and I'd prefer to "connect" to ConfigMgr via PowerShell using my "admin" account.
I'm thinking the least impactful way to do it would be for the module to honor an environment or pssessionpreference for "NoAutoCreatePSDrive" or the like (rather like the AD module) and the allow creating the PSDrive manually with alternate credentials.
This work has been completed for 1710.
Docs are in the process of being published.
Do disable auto-load of the PSDrive, create the following registry key:
Create a DWORD value called DisableCMDriveAutoCreate and set to 1 to disable auto-creation or 0 for default behavior. Deleting this registry value also restores default behavior.
Note that by disabling CMDrive auto-creation, the PowerShell window created from the admin console will write errors and will not be useable until you manually load the ConfigurationManager.psd1 module.
We are planning an additional change into 1802 where will write a warning to the console when importing the ConfigurationManager.psd1 module if this setting is enabled for additional awareness.