Author Posts

March 31, 2016 at 12:26 am

Hi, I have created PowerShell module (with bunch of advanced functions) and module manifest. Autoloading of my module works fine but I have problems with autoloading of other PowerShell modules downloaded from the Internet such as ADReplication module, Carbon module and PDFTools module. All these modules and mine too are located where they should be:

%userprofile%\Documents\WindowsPowerShell\Modules

and each of them has its own module manifest. I am not sure but I think before I created mine module manifest autoloading of downloaded modules worked fine. What is the catch here?

April 6, 2016 at 9:54 am

What's your PSModulePath environment variable, and what's your execution policy?

April 6, 2016 at 2:26 pm

Meanwhile I deleted Tools.psd1 file.

$env:PSModulePath -split ";" returns:

C:\Users\admbojan.zivkovic\Documents\WindowsPowerShell\Modules
C:\Program Files\WindowsPowerShell\Modules
C:\Windows\system32\WindowsPowerShell\v1.0\Modules\
C:\Program Files\Microsoft System Center 2012 R2\Operations Manager\Powershell\

Get-ExecutionPolicy returns: Unrestricted

Also:

PS C:\> get-module -Name pdftools,adreplication,carbon,importexportexcel,tools -ListAvailable

Directory: C:\Users\admbojan.zivkovic\Documents\WindowsPowerShell\Modules

ModuleType Version Name ExportedCommands
———- ——- —- —————-
Script 2.0 ADReplication {Get-ADDomain, Get-ADForest, Get-ADLastChanges, Get-ADReplicationConnection...}
Script 2.0.1 Carbon {Add-GroupMember, Add-TrustedHost, Assert-AdminPrivilege, Assert-FirewallConfigurable...}
Script 0.0 ImportExportExcel {Import-Excel, Export-Excel}
Script 1.0 PDFTools Out-PTSPDF
Script 0.0 Tools {Fix-NetworkLocationAwarenessService, New-PubRegKeySSO, Add-UserToLocalAdminsGroup, Remo...

PS C:\> Get-ChildItem -Path C:\Users\admbojan.zivkovic\Documents\WindowsPowerShell\Modules\

Directory: C:\Users\admbojan.zivkovic\Documents\WindowsPowerShell\Modules

Mode LastWriteTime Length Name
—- ————- —— —-
d—– 1/21/2016 9:07 AM ADReplication
d—– 11/19/2015 12:55 PM Carbon
d—– 3/31/2016 10:34 AM ImportExportExcel
d—– 11/17/2015 1:06 PM PDFTools
d—– 4/5/2016 12:55 AM Tools

Autoloading of modules ADReplication, ImportExportExcel and Tools works, Carbon and PDFTools does not. When I had Tools.psd1 file problems existed too. Apart from Tools module others are downloaded and copied to ...\Modules folder