Running a Script as a different user throws 'A parameter cannot be found that matches parameter name 'Credential'.' RRS feed

  • Question

  • This has happened for a couple of scripts that I have tried to run.

    We have a separate domain user that we use to schedule tasks with. This user has all of the permissions that it needs to access the script path and run the script. When I pass this command:

    & "C:\ScheduledTasks\RunMemberDBAutomation.ps1"

    I get back this error:

    Import-Module : A parameter cannot be found that matches parameter name 'Credential'.
    At C:\ScheduledTasks\RunMemberDBAutomation.ps1:29 char:1
    + Import-Module SCCMemberDB
    + ~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : InvalidArgument: (:) [Import-Module], ParameterBindingException
        + FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand

    As you can see, I'm not naming the Credential parameter when I call Import-Module, but the error claims I am wrongfully doing so.

    Has anyone else seen this before? It's not the first time for me and I've found no clues as to why.


    Wednesday, October 3, 2018 5:42 PM

All replies

  • Don't do this:

    & "C:\ScheduledTasks\RunMemberDBAutomation.ps1"

    Just do this:


    I see no "Import-Module" anywhere in your script. Perhaps you posted the wrong script.


    Wednesday, October 3, 2018 6:03 PM
  • Hi,

    Was your issue resolved?

    If you resolved it using our solution, please "mark it as answer" to help other community members find the helpful reply quickly.

    Best Regards,


    Just do it.

    Friday, October 26, 2018 8:44 AM
  • Hi,

    As this thread has been quiet for a while, we will mark it as ‘Answered’ as the information provided should be helpful. If you need further help, please feel free to reply this post directly so we will be notified to follow it up. You can also choose to unmark the answer as you wish.

    Best Regards,


    Just do it.

    Monday, November 5, 2018 9:23 AM