0

Ive created a script for users in my company to use with powershell ise and when I run it there using F5 it is working.

Ive set the executionpolicy to unrestricted as well.

Later Ive tried to open this script with powershell.exe because I need it to run straight for the users, and it gave the error:

The term "C:\users\ofir\Script\Json is not recognized as a cmdlet, function, script file, or operable program..

What could be the problem? Thanks, Ofir.

3
  • What, exactly, did you do when Ive tried to open this script with powershell.exe ? Typed something (what, where, how)? Clicked something (what, where, how)? Commented Jan 2, 2017 at 7:52
  • I was right clicking the file of the Ise and changed it to be "Opened with" powershell.exe Commented Jan 2, 2017 at 7:54
  • 1
    For security reasons, Powershell scripts are not intended to be run by clicking around. Is the file name exactly Json? If it is, add the missing .ps1 extension. Commented Jan 2, 2017 at 9:14

1 Answer 1

1

As I suspect you to run the file like powershell.exe -file C:\Users\What\Not\Json File.ps1 I could think of missing quotationmarks.

Try

  Powershell.exe -file "Path\To\File"
Sign up to request clarification or add additional context in comments.

3 Comments

Without knowing the exact error, speculative answer isn't going to be helpful for others that might encounter similar problems.
Well, the error message it self gives quite some useful info, as powershell does not seem to recon the path. It even shows that the path must have whitespaces in it that were not considered. So, it is not really guessing into the blue.
Given the error message posted, I'd say this is qualified guesswork, not just speculation, +1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.