Open eissko opened 4 years ago
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'..
The error is comming from function Get-VstsAgent - line 430
Get-ChildItem "$AgentDirectory**.agent" -Attributes '!D+H,!D' -ErrorAction SilentlyContinue | ...
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?
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"
}
}
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": {