Extra character placed in path of DSC config - Azure PS - json

I'm trying to work out why I'm getting the error below; the path to the configuration.ps1 file should be configuration\configuration.ps1, however its failing as its reading it as configuration.0\configuration.ps1.
the whole error message is below, has anyone else come across this?
"status": "Failed",
"error": {
"code": "ResourceDeploymentFailure",
"message": "The resource operation completed with terminal provisioning state 'Failed'.",
"details": [
{
"code": "VMExtensionProvisioningError",
"message": "VM has reported a failure when processing extension 'CreateADPDC'. Error message: \"The DSC Extension received an incorrect input: An error occurred while
executing script or module 'configuration.ps1': The term 'C:\\Packages\\Plugins\\Microsoft.Powershell.DSC\\2.77.0.0\\bin\\..\\DSCWork\\configuration.0\\configuration.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..\nPlease correct the input and retry executing the extension.\"."
}
]
}
}'
At line:4 char:14
+ ... New-AzureRmResourceGroupDeployment -Name "coredeployment1 ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [New-AzureRmResourceGroupDeployment], Exception
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.NewAzureResourceGroupDeploymentCmdlet
New-AzureRmResourceGroupDeployment : 18:31:08 - VM has reported a failure when processing extension 'CreateADPDC'. Error message: "The DSC Extension received an incorrect input: An
error occurred while executing script or module 'configuration.ps1': The term
'C:\Packages\Plugins\Microsoft.Powershell.DSC\2.77.0.0\bin\..\DSCWork\configuration.0\configuration.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..
Please correct the input and retry executing the extension.".
Thanks in advance :)

Related

Appflow Update_flow error : Destination object for the destination connector can not be updated

Anyone faced this error while calling update_flow for appflow?
errorMessage": "An error occurred (ValidationException) when calling the UpdateFlow operation: Update Flow request failed due to:[Destination object for the destination connector can not be updated]",
"errorType": "ValidationException",
"stackTrace": [
" File "/var/task/lambda_function.py", line 7, in lambda_handler\n response = client.update_flow (\n",
" File "/var/runtime/botocore/client.py", line 357, in _api_call\n return self._make_api_call(operation_name, kwargs)\n",
" File "/var/runtime/botocore/client.py", line 676, in _make_api_call\n raise error_class(parsed_response, operation_name)\n"
What could be the cause.
This is resolved. Appflow doesnt allow to change the destination folders using update_flow. you have to set it exact same as existing flow.

Running WinRM quickconfig for remote servers

I am writing a PowerShell script that reads in a list of hosts from a file. I have tried two separate methods, having issues with both.
First Method:
$WinRM = Invoke-Command -Computer $server -ScriptBlock { WinRM quickconfig }
This gives the following error message on some of the hosts:
WSManFault
+ CategoryInfo : NotSpecified: (WSManFault:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
+ PSComputerName : svclebetapool01.lehi.micron.com
Message = Access is denied.
Error number: -2147024891 0x80070005
Access is denied.
Second Method:
$WinRM = C:\PSTools\PsExec.exe \\$server -s winrm.cmd quickconfig -q
This sets $WinRM to the exit code (1 on successful execution). If I redirect the output with > or >>, then it displays the PsExec copyright. I am looking for the exact message that is created by the WinRM quickconfig command so that I know how to handle it in different situations.
if your intention is to enable PowerShell remoting, then you can
C:\PSTools\PsExec.exe \\$server PowerShell.exe -c "Enable-PSRemoting -Force"
or
wmic /node:$Server process call create "PowerShell.exe -c 'Enable-PSRemoting -Force'"

npm unexpected token / in config.json at position 98

I have seen several unexpected token errors related to npm but this one is yet again unique to me. I could not find any similar issues posted by others. My config file just has connection objects to my local mongodb, rabbitmq "amqp", wordpress plugin and mysql DB.
Could anyone help me with this error in case they've seen it before?
C:\xampp\htdocs\livetrader\chat\node_modules\nconf\lib\nconf\stores\file.js:160
throw new Error("Error parsing your configuration file: [" + this.file + ']: ' + ex.message);
^
Error: Error parsing your configuration file:
[C:\xampp\htdocs\livetrader\chat/config.json]: Unexpected token / in JSON at position 98
Updating this post with the config.json file referenced in this error
{
"port": 1337,
"mongoose": {
"uri": "mongodb://localhost:27017/livetrader"
},
"amqp":{
"uri": "amqp://guest:guest#localhost:15672",
"queue": "TickData"
},
"sql":{
"host":"localhost",
"database":"db_main",
"user":"root",
"password":""
},
"wp":{
"host":"http://forextrader.dev",
"LOGGED_IN_KEY":"MY_LOGGED_IN_KEY",
"LOGGED_IN_SALT":"MY_LOGGED_IN_SALT",
"prefix":"wp_",
"avatarPath":"http://localhost/livetrader/wp-content/uploads/avatars",
"myCreedApi":"MY_API_KEY"
},
"guest":{
"cookie_name": "trading-forex-guest",
"ttl": 180
}
}
Updating the back-end config path
"use strict";
var nconf = require('nconf');
nconf.argv()
.env()
.file({
file: process.cwd() + '/config.json'
});
module.exports = nconf;
Your JSON file is property formatted. JSON.parse() takes it, no problem. Character 98 is not a slash, either.
There is, however, a suspicious slash in your path:
C:\xampp\htdocs\livetrader\chat/config.json
The final slash is unix-style, not windows-style. Could that be causing the problem?
If that's not it, you must be reading the wrong file, or passing it the wrong way to a function. Try using console.log to figure out what exactly is reaching JSON.parse().
Giving objects to JSON.parse() can cause unexpected errors, since .toString() is invoked. For example:
> JSON.parse({a:1})
SyntaxError: Unexpected token o in JSON at position 1
> ({a:1}).toString()
'[object Object]'
So, to recap, you must be:
Reading the wrong file
Passing an object that's not a String to JSON.parse()
Having a strange problem with the inverted slash in the path

PowerShell: fatal errors don't get sent to STDERR, how to log them?

I have a PowerShell script on my desktop:
Write-Output "Some output"
Write-Error "Non-fatal error"
$ErrorActionPreference = "Stop" # Any further errors should be treated as fatal
Write-Output "Some more output"
Write-Error "Fatal error"
I call it this way from powershell.exe:
PS C:\Users\me\Desktop> .\test.ps1 2> err.txt 1> out.txt
Output:
C:\Users\vmadmin\Desktop\test.ps1 : Fatal error
At line:1 char:1
+ .\test.ps1 2> err.txt 1> out.txt
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,test.ps1
out.txt:
Some output
Some more output
err.txt:
C:\Users\vmadmin\Desktop\test.ps1 : Non-fatal error
At line:1 char:1
+ .\test.ps1 2> err.txt 1> out.txt
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,test.ps1
I would like the fatal error to get logged to err.txt. How can I accomplish that?
PowerShell has two different channels for error-handling: the first is STDERR, to which non-fatal errors get written. The second is an exception mechanism, similar to what you would see in programming languages like C# or Java.
Here's the trick: any error is in either one channel or the other, never both. This means that fatal errors do not go through STDERR!
Here's a workaround: wrap your PowerShell calls in a cmd call. Since the cmd language does not have exceptions, any PowerShell exceptions that go through it get piped into STDERR.
Example usage:
PS C:\Users\me\Desktop> cmd.exe /c "powershell.exe .\test.ps1" 2> err.txt 1> out.txt

Exception while try to get jmeter directory

I would like to start jmeter load test via console but it's Data Driven Load Test, so I need to read some information from csv files. I found a solution to include into User Parameters row to get the path to the place where the script was launched:
${__BeanShell(newFile(org.apache.jmeter.gui.GuiPackage.getInstance().getTestPlanFile().toString()).getParent())}
but I got an error in logs:
2013/06/11 15:23:54 ERROR - jmeter.util.BeanShellInterpreter: Error
invoking bsh method: eval Sourced file: inline evaluation of:
``newFile(org.apache.jmeter.gui.GuiPackage.getInstance().getTestPlanFile().toStrin
. . . '' : Command not found: newFile( java.lang.String )
2013/06/11 15:23:54 WARN - jmeter.functions.BeanShell: Error running
BSH script org.apache.jorphan.util.JMeterException: Error invoking bsh
method: eval Sourced file: inline evaluation of:
``newFile(org.apache.jmeter.gui.GuiPackage.getInstance().getTestPlanFile().toStrin
. . . '' : Command not found: newFile( java.lang.String ) at
org.apache.jmeter.util.BeanShellInterpreter.bshInvoke(BeanShellInterpreter.java:192)
What's wrong with this method?
The issue is you have:
newFile
instead of:
new File