Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Some imported command names contain one or more of the following restricted characters

Tags:

powershell

Using my own Powershell script module in Octopus, Octopus is warning that

WARNING: Some imported command names contain one or more of the following restricted characters: # , ( ) {{ }} [ ] & - / \ $ ^ ; : " ' < > | ? @ ` * % + = ~

The script module looks like this

function complete-iis-config($poolAndSitenameFilter)
{
 # do stuff
}

export-modulemember -function complete-iis-config
like image 942
fiat Avatar asked Oct 05 '17 04:10

fiat


People also ask

How do I import a PowerShell script module?

In PowerShell 2.0, you can import a newly-installed PowerShell module with a call to Import-Module cmdlet. In PowerShell 3.0, PowerShell is able to implicitly import a module when one of the functions or cmdlets in the module is called by a user.

How do I automatically load PowerShell modules?

Module Auto-Loading Beginning in PowerShell 3.0, PowerShell imports modules automatically the first time that you run any command in an installed module. You can now use the commands in a module without any set-up or profile configuration, so there's no need to manage modules after you install them on your computer.

What is the difference between import-module and install module?

Install-Module installs the necessary files to your computer to run/load the module. Either to your profile path or to the program files folder. Import-Module loads an available module to the currently running instance of Powershell.


1 Answers

This is because I used a hyphen twice. The Verb-Noun PowerShell guideline means there should only be one hyphen.

Renaming my function to Complete-IisConfig cleared the warning

like image 58
fiat Avatar answered Sep 20 '22 17:09

fiat