skip to Main Content

I rebooted my machine, and tried running the debugger again. Still fails to launch. Here’s what I got.

WARNING: The names of some imported commands from the module ‘TchPublisherArguments’ include unapproved verbs that might make them less discoverable. To find the commands with unapproved verbs, run the Import-Module command again with the Verbose parameter. For a list of approved verbs, type Get-Verb.
Write-Error: The term ‘Send-Files’ is not recognized as a name of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

MyCommand             : 
BoundParameters       : {}
UnboundArguments      : {}
ScriptLineNumber      : 303
OffsetInLine          : 34
HistoryId             : 1
ScriptName            : C:UsersDickDocumentstchcodescriptsPowerShellmodulesTchPublisherArgumentsTchPublisherArguments.psm1       
Line                  :       "send-local-clear"       { Send-Files -target local  -clearArchive $true  ; Confirm-AndExit }

PositionMessage       : At
                        C:UsersDickDocumentstchcodescriptsPowerShellmodulesTchPublisherArgumentsTchPublisherArguments.psm1:303   
                        char:34
                        +       "send-local-clear"       { Send-Files -target local  -clearArch …
                        +                                  ~~~~~~~~~~
PSScriptRoot          : C:UsersDickDocumentstchcodescriptsPowerShellmodulesTchPublisherArguments
PSCommandPath         : C:UsersDickDocumentstchcodescriptsPowerShellmodulesTchPublisherArgumentsTchPublisherArguments.psm1       
InvocationName        : Send-Files
PipelineLength        : 0
PipelinePosition      : 0
ExpectingInput        : False
CommandOrigin         : Internal
DisplayScriptPosition : 

3

Answers


  1. Chosen as BEST ANSWER

    Well I found a workaround, though not a satisfactory answer. I replaced the verb Send with the verb Publish, and the error disappeared.

    The question still remains, though as to why PowerShell complained about Send, and not about Publish. If I recall correctly, it complained at Publish this morning or yesterday, and that's why I changed it to Send. But both verbs are approved, so it shouldn't have complained about either.

    But at least now I can continue to work.

    Thanks to all who tried to help!


  2. Does Send-Files exist within your TchPublisherArguments module, and if so, is your code running successfully but just showing that warning each time?

    If so then the warning simply relates to the fact that you’re using a verb, eg Send, that isn’t approved for use within PowerShell by Microsoft, as for consistency across scripts they recommend using consistent verbs.

    It it just a warning, so you can optionally override it so the warning no longer shows up by calling the module with

    Import-Module TchPublisherArguments -disablenamechecking
    

    You can see a list of the approved verbs and their usage here https://learn.microsoft.com/en-us/powershell/scripting/developer/cmdlet/approved-verbs-for-windows-powershell-commands?view=powershell-7.3

    though I notice Send is on the list, but it’s listed under Communications Verbs, so in this case it may also be because you’re using it unintended purposes, rather than perhaps Copy- or Move- for transferring a file/resource from one place to another, which in the contact of files is what I’d guess you’re doing.

    Login or Signup to reply.
  3. Not able to reproduce the issue:

    Create a Minimal, Reproducible Example:

    • Create file named: .Send-Files.psm1
    • Add content:
    function Send-Files {
        param()
        Write-Host 'Sending Files...'
    }
    
    Export-ModuleMember -Function Send-Files
    
    • Import the module: Import-Module .Send-Files.psm1
      (No warnings received)

    As an aside, the PowerShell team best practices state cmdlets should use singular nouns and not plurals.
    In other words it is recommended to use the cmdlet name: Send-File instead. Knowing that if your cmdlet correctly supports Input from the Pipeline, it should send each file one by one.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search