This is the code i have written in my tut63.js file
code
console.log('Hello World');
when i type node tut63.js in terminal it was suppose to show " Hello World ".
But instead it is showing this error in terminal.
code
PS C:\Users\m\Desktop> node.tut63.js
The term 'node.tut63.js' is not recognized as the name of a cmdlet, function, script file, or oper
able program. Check the spelling of the name, or if a path was included, verify that the path is c
orrect and try again.
At line:1 char:14
node.tut63.js <<<<
CategoryInfo : ObjectNotFound: (node.tut63.js:String) [], CommandNotFoundException
FullyQualifiedErrorId : CommandNotFoundException
Related
Current setup:
Manually launched Windows server 2019 instance with nodes app in AWS.
Below commands are working fine with this instance
Pm2 delete myapp
Pm2 start
Issue :
We have created AMI of the above instance and launched it with a cloudformation template.
In the userdata of cloudformation template, we have made some changes in the config file of nodejs and restarting the nodes app with the above commands.
Output:
config file modified successfully with cloduformation userdata
Error:
The above commands (Pm2 delete myapp and Pm2 start) failed in the execution of userdata. below is the userdata log.
The errors from user scripts: pm2 : The term 'pm2' 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 C:\Windows\TEMP\UserScript.ps1:15 char:1
+ pm2 delete RenderWorker
+ ~~~
+ CategoryInfo : ObjectNotFound: (pm2:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
pm2 : The term 'pm2' 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 C:\Windows\TEMP\UserScript.ps1:16 char:1
+ pm2 start
+ ~~~
+ CategoryInfo : ObjectNotFound: (pm2:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Other findings:
Pm2 command is available with newly launched ec2 instance.
C:\Users\Administrator>pm2
usage: pm2 [options] <command>
pm2 -h, --help all available commands and options
pm2 examples display pm2 usage examples
pm2 <command> -h help on a specific command
Access pm2 files in ~/.pm2
Userdata in cloudofrmation:
UserData:
Fn::Base64: !Sub |
<powershell>
$config = '{
"MyENV": "${MyENV}",
"UR1L": "${URL1}",
"URL2": "${URL2}",
"BUCKET": "${MyBucket}",
"PATH": "${Mypath}"
}'
echo $config
$config | Set-Content C:\Projects\myapp\settings\config.json
cd 'C:\Projects\myapp'
pm2 delete RenderWorker
pm2 start
</powershell>
<runAsLocalSystem>true</runAsLocalSystem>
<persist>true</persist>
I doubt that you can run pm2 directly like that because the path to pm2 does not exist under SYSTEM path.
You are likely required to include the full path of it as follows to run the command.
For example, your pm2 resides under C:\etc\ then you need to include as follows:
C:\etc\.pm2 delete RenderWorker
C:\etc\.pm2 start
or if you are familiar with the path, you can make it as an environment variable.
I am getting this error:
Generating script.
Script contents:
docker run -p 9988:1433 aneste:mssql
========================== Starting Command Output ===========================
"C:\windows\system32\cmd.exe" /D /E:ON /V:OFF /S /C "CALL "D:\a\_temp\31deb425-e236-4cf3-bfe7-aed9ce46dd35.cmd""
.\start : The term '.\start' 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:76
+ ... e = 'Stop'; $ProgressPreference = 'SilentlyContinue'; .\start -sa_pas ...
+ ~~~~~~~
+ CategoryInfo : ObjectNotFound: (.\start:String) [], ParentConta
insErrorRecordException
+ FullyQualifiedErrorId : CommandNotFoundException
##[error]Cmd.exe exited with code '1'.
I have tried to search for a solution for a while now but can't seem to find one, not eaven sure what causes it, docker ls outputs the docker image correctly.
EDIT:
Yaml file
I am getting the error below:
2020-09-17T10:05:00.724 [Error] ERROR: Error logging into WVD: The
term 'Get-AutomationPSCredential' 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.Exception :Type :
Microsoft.PowerShell.Commands.WriteErrorExceptionMessage : Error
logging into WVD: The term 'Get-AutomationPSCredential' 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.HResult :
-2146233087CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorExceptionFullyQualifiedErrorId :
Microsoft.PowerShell.Commands.WriteErrorException,_TimerTrigger1_InvocationInfo
:MyCommand : _TimerTrigger1_HistoryId : 1InvocationName :
_TimerTrigger1_CommandOrigin : InternalScriptStackTrace : at <ScriptBlock>, D:\home\site\wwwroot\TimerTrigger1\run.ps1: line
158Microsoft.Azure.WebJobs.Script.Workers.Rpc.RpcException : Result:
ERROR: Error logging into WVD: The term 'Get-AutomationPSCredential'
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.Exception
:Type : Microsoft.PowerShell.Commands.WriteErrorExceptionMessage :
Error logging into WVD: The term 'Get-AutomationPSCredential' 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.HResult :
-2146233087CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorExceptionFullyQualifiedErrorId :
Microsoft.PowerShell.Commands.WriteErrorException,_TimerTrigger1_InvocationInfo
:MyCommand : _TimerTrigger1_HistoryId : 1InvocationName :
_TimerTrigger1_CommandOrigin : InternalScriptStackTrace : at <ScriptBlock>, D:\home\site\wwwroot\TimerTrigger1\run.ps1: line
158Exception: Error logging into WVD: The term
'Get-AutomationPSCredential' 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.Stack:
I have seen information online that suggests it is part of the module "AzureAutomationAuthoringToolkit", but I don't understand how I install this into the environment the Function App runs in.stuff and am following a blog post below to try and get the auto-start up shut down working. I am fairly certain that I have followed this correctly. To me the error suggests that the environment doesn't have the module loaded.
https://www.ciraltos.com/auto-start-and-stop-session-hosts-in-windows-virtual-desktop-spring-update-arm-edition-with-an-azure-function/
I don't think you can use the command Get-AutomationPSCredential in the azure function, it is an Internal cmdlet belongs to the internal module Orchestrator.AssetManagement.Cmdlets, it is only available when you're executing runbooks in the Azure sandbox environment, or on a Windows Hybrid Runbook Worker.
So in your case, your option is to use the script in the automation powershell runbook, then use Invoke-WebRequest in the timer trigger to invoke the web request to the webhook URL of the runbook to start the runbook(As the script should be ran every 5 mins said by author).
Invoke-WebRequest -Uri <Webhook URI> -Method Post
For more details, you could refer to the link mentioned in the Github repo.
I am trying to automatically publish all the projects of my .NET solution using the DeplyOnBuild=true argument (according to this answer )
I typed this command in the PowerShell:
msbuild mysolultion.sln /p:Configuration=Debug;DeployOnBuild=true;
But I get the following error message :
The term 'DeployOnBuild=true' 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:59
+ msbuild mysolution.sln /p:Configuration=Debug;DeployOnBuild=true <<<< ;
+ CategoryInfo : ObjectNotFound: (DeployOnBuild=true:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
I am not sure what I am doing wrong.
PowerShell is interpreting everything after your first semicolon as a separate command.
You need to use quotes:
MSBuild example.sln /p:"Configuration=Debug;DeployOnBuild=true;"
Or use separate /p parameters:
MSBuild example.sln /p:Configuration=Debug /p:DeployOnBuild=true
Im need to using node --harmony each time when working with node.recently im working with koajs and in the home page of koajs sayed can use this command
alias node='node --harmony'
but when i calling this command on powershell i get this error :
alias : This command cannot find a matching alias because an alias with the name 'node=node --harmony' does not exist.
At line:1 char:1
+ alias node='node --harmony'
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (node=node --harmony:String) [Get-Alias], ItemNotFoundException
+ FullyQualifiedErrorId : ItemNotFoundException,Microsoft.PowerShell.Commands.GetAliasCommand
so how can change alias of node to node with harmony argument?