某些导入的命令名称包含以下一个或多个受限字符

fia*_*iat 3 powershell

在章鱼中使用我自己的Powershell脚本模块,章鱼警告说

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

脚本模块如下所示

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

export-modulemember -function complete-iis-config
Run Code Online (Sandbox Code Playgroud)

fia*_*iat 7

这是因为我两次使用了连字符。在Verb-NounPowerShell的方针意味着应该只有一个连字符。

重命名我的功能以Complete-IisConfig清除警告

  • 导入模块时,也可以使用“ -DisableNameChecking”标志。有时,有充分的理由不遵守规则和约定。不过不经常。 (2认同)