locked
JEA & running ps1 files RRS feed

  • Question

  • I am setting up JEA for the first time and I am running into trouble with running custom .ps1 files. To test if it was .ps1 file I made another simple one that is just a write-host "hello" called hello.ps1. When I connect to the session and type Hello.ps1 I receive the following error:

    The term 'Hello.ps1' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path 
    is correct and try again.
        + CategoryInfo          : ObjectNotFound: (Hello.ps1:String) [], CommandNotFoundException
        + FullyQualifiedErrorId : CommandNotFoundException

    In the .psrc file I have:

     VisibleExternalCommands = 'C:\Windows\System32\whoami.exe','C:\Program Files\WindowsPowerShell\Modules\JEA\Hello.ps1'

    I have verified that whoami does work, so it looks like I have the .psrc file correctly configured. Since I only have permission to run the whoami I am also assuming I have the .pssc configured correctly.

    Friday, July 27, 2018 12:54 PM

All replies

  • The session cannot find the file.  Use the full path to the file.  Be sure the session has execute permission on the file.


    \_(ツ)_/

    Friday, July 27, 2018 1:06 PM
  • I did try the full path thinking that was the issue as well, but it gave me the same message. 

    The execution policy is remote-signed and the script is signed with a valid certificate. 

    Friday, July 27, 2018 2:39 PM
  • Finally figured it out. I forgot to unregister and register the session after I made changes to the .pssc.
    Friday, July 27, 2018 3:00 PM