PowerShell 5; Windows 7.
I have a simple psm1 module and cannot import it with arguments. I have read somewhere that this is possible with the -ArgumentList parameter:
function Test-Module { param([String]$newFile = 'C:\test') Write-Warning $newFile }
I have tried Import-Module -Name Test-Module -Force -ArgumentList ‘d:\Something’ but
this is not working as it always outputs ‘C:\test’. I am obviously missing something very simple. Any ideas please?
I can now answer this myself: The param line needs to be before the function call and it all works.