I am new to PS and have been given a script to run. The first thing I do is type in c:\powershell\ir.ps1
. This seems to work. Then after defining my clients directory I am supposed to be able to just type in functions such as ir-n
. This worked at the person's desk that showed me how to do it, but I get the following error:
The term 'ir-n' 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.
At line:1 char:5
+ ir-n <<<<
+ CategoryInfo : ObjectNotFound: (ir-n:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Is there something simple I can do to get it to run? I see the function in the ir.ps1
file so I know it is there.
It looks like you are running the ir.ps1
script when you should be sourcing it. I'm guessing that the ir.ps1
file is defining a function named ir-n
. In that case running the script will not define the function in the script's context but not the command window. You need to source the script to get it to persist in the command window.
Try running the following
PS$> . c:\powershell\ir.ps1
After running this then try ir-n
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With