Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A parameter cannot be found that matches parameter name \u0027Attributes\u0027. #19

Open
eissko opened this issue Nov 7, 2019 · 4 comments

Comments

@eissko
Copy link

eissko commented Nov 7, 2019

Hello Microsoft,
hitting error only first cycle when applying DSC resource xVSTSAgent in azure automation account from module of version 2.0.8. The next 2nd cycle of DSC is successfull. Here is error message:
{
"Exception": {
"Message": "The PowerShell DSC resource \u0027[xVSTSAgent]xVSTSAgent 10\u0027 with SourceInfo \u0027::52::17::xVSTSAgent\u0027 threw one or more non-terminating errors while running the Test-TargetResource functionality. These errors are logged to the ETW channel called Microsoft-Windows-DSC/Operational. Refer to this channel for more details.",
"Data": {

                           },
                  "InnerException":  {
                                         "Message":  "A parameter cannot be found that matches parameter name \u0027Attributes\u0027.",
                                         "ParameterName":  "Attributes",
                                         "ParameterType":  null,
                                         "TypeSpecified":  null,
                                         "ErrorId":  "NamedParameterNotFound",
                                         "Line":  430,
                                         "Offset":  47,
                                         "CommandInvocation":  "System.Management.Automation.InvocationInfo",
                                         "ErrorRecord":  "A parameter cannot be found that matches parameter name \u0027Attributes\u0027.",
                                         "WasThrownFromThrowStatement":  false,
                                         "Data":  "System.Collections.ListDictionaryInternal",
                                         "InnerException":  null,
                                         "TargetSite":  "Void VerifyArgumentsProcessed(System.Management.Automation.ParameterBindingException)",
                                         "StackTrace":  "   at System.Management.Automation.CmdletParameterBinderController.VerifyArgumentsProcessed(ParameterBindingException originalBindingException)\r\n   at System.Management.Automation.CmdletParameterBinderController.BindCommandLineParametersNoValidation(Collection`1 arguments)\r\n   at System.Management.Automation.CmdletParameterBinderController.BindCommandLineParameters(Collection`1 arguments)\r\n   at System.Management.Automation.CommandProcessor.BindCommandLineParameters()\r\n   at System.Management.Automation.CommandProcessorBase.DoPrepare(IDictionary psDefaultParameterValues)\r\n   at System.Management.Automation.Internal.PipelineProcessor.Start(Boolean incomingStream)\r\n   at System.Management.Automation.Internal.PipelineProcessor.SynchronousExecuteEnumerate(Object input)\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Management.Automation.Internal.PipelineProcessor.SynchronousExecuteEnumerate(Object input)\r\n   at System.Management.Automation.PipelineOps.InvokePipeline(Object input, Boolean ignoreInput, CommandParameterInternal[][] pipeElements, CommandBaseAst[] pipeElementAsts, CommandRedirection[][] commandRedirections, FunctionContext funcContext)\r\n   at System.Management.Automation.Interpreter.ActionCallInstruction`6.Run(InterpretedFrame frame)\r\n   at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)",
                                         "HelpLink":  null,
                                         "Source":  "System.Management.Automation",
                                         "HResult":  -2146233087
                                     },
                  "TargetSite":  null,
                  "StackTrace":  null,
                  "HelpLink":  null,
                  "Source":  null,
                  "HResult":  -2146233079
              },
"TargetObject":  null,
"CategoryInfo":  {
                     "Category":  7,
                     "Activity":  "",
                     "Reason":  "InvalidOperationException",
                     "TargetName":  "",
                     "TargetType":  ""
                 },
"FullyQualifiedErrorId":  "NonTerminatingErrorFromProvider",
"ErrorDetails":  null,
"InvocationInfo":  null,
"ScriptStackTrace":  null,
"PipelineIterationInfo":  [

                          ]
@eissko
Copy link
Author

eissko commented Nov 7, 2019

And this is an error from eventvwr.msc:
Job {73390701-015C-11EA-A80E-000D3AA83F09} :
This event indicates that a non-terminating error was thrown when DSCEngine was executing Test-TargetResource on xVSTSAgent DSC resource. FullyQualifiedErrorId is NamedParameterNotFound,Microsoft.PowerShell.Commands.GetChildItemCommand. Error Message is A parameter cannot be found that matches parameter name 'Attributes'..

@eissko
Copy link
Author

eissko commented Nov 19, 2019

The error is comming from function Get-VstsAgent - line 430

Get-ChildItem "$AgentDirectory**.agent" -Attributes '!D+H,!D' -ErrorAction SilentlyContinue | ...

@jwittner
Copy link
Member

Very strange, Get-ChildItem definitely has the Attributes parameter. Even as far back as Version 3.0 of PowerShell. Can I ask what versions of PowerShell you're using, and what your $AgentDirectory is?

@eissko
Copy link
Author

eissko commented Nov 19, 2019

I know - that's very strange issue. I would like to put emphasis again on the fact that only 1st cycle of DSC fails. 2nd one is allright. Here below is snippet from DSC configuration - creating volume, the folder and then installing agents in the loop. DependsON should keep the correct flow.

Powershell 5.1 is used

    xDisk CreateDiskVolume
    {
        DiskId = 2
        DriveLetter = "F:"
        DiskIdType = "number"
        FSFormat = "NTFS"
        FSLabel = "agents"
    }

    File CreateFolder {
        Type = 'Directory'
        DestinationPath = 'F:\VSTSAgents\'
        Ensure = "Present"
        DependsOn = "[xDisk]CreateDiskVolume"
    }

    $i=1
    for($i;$i -le $agentCount; $i++){    

            xVSTSAgent "xVSTSAgent $i" {
                Name               = ("{0}{1}" -f "Agent", $i)
                Pool               = $agentPoolName
                ServerUrl          = $ServerUrl
                AccountCredential  = $accountCredential
                AgentDirectory     = "F:\VSTSAgents\"
                Ensure             = "Present"
                PrefixComputerName = $True
                DependsOn          = "[File]CreateFolder"
            }
    }   

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants