Techibee.com

Loading ActiveDirectory PowerShell module without default AD: Drive

One thing that I don’t like while working with ActiveDirectory PowerShell module is, it’s slowness in loading and the crazy progress bar that it shows while creating default AD: drive.

Honestly, I don’t use the AD: ps drive to manage active directory objects as the cmdlets are sufficient enough for most of the operations. Moreover, seeing this progress bar while running the scripts that loads ActiveDirectory module is not nice thing. Also creating the AD: drive is taking quite a bit of time.

I wanted to get rid of all these and just want to import the AD cmdlets alone. While searching for that, I come across a post from Active Directory PowerShell team which helped me. To suppress the progress bar, just below one line before calling the Import-Module.

$Env:ADPS_LoadDefaultDrive = 0

So, that makes your code look like below. With this the import operation will complete fast and you don’t see the progress bar as well.

$Env:ADPS_LoadDefaultDrive = 0            
Import-Module -Name ActiveDirectory            
Get-ADUser -Identity "testuser1"

Hope this helps and happy learning.

Exit mobile version