Forum Discussion
Medy51730
Feb 01, 2022Copper Contributor
Help scrt powershell Azure devops
Hi all.
Sorry for the translation.
I have a problem with a script (which was already working), I can't get my data, the script is used to reach Azure development services and returns an array, which I then save to a JSON file but for a few weeks I have to work.
No change was made and as soon as the authentication is already valid.
Separately there is no issue, the problem is in the matrix, I attach a piece of code.
$Capacities += New-Object -TypeName PSObject -Property {
ProjectName=$project.name
TeamName=$team.name
SprintName=$sprintteam.name
SprintStartDate="{0:yyyy-MM-dd}"-f $startDate
S
}
}
$Capacities | ConvertTo-Json | Out-File -FilePath "$home\desktop\Capacities.json"
- SteveMacNZIron Contributoris there an error message generated?
Are you running the script in user or admin context? have you tried changing the filepath to an absolute path (e.g. C:\temp\Capacities.json) - Jonathan_AllenBrass ContributorYou have an 'S' on a line before the closing '}' that would be a syntax error. Has something been partly deleted from this line or has the 'S' been added by mistake?
There is an extra closing '}' which is not needed in the code extract you provided - it might be needed to close some syntax construct that hasnt been supplied so this might be correct. - Jonathan_AllenBrass Contributor
This adapted sample
$Capacities += [PSCustomObject]@{ ProjectName = 'project' #$project.name TeamName = 'team' #$team.name SprintName = 'sprint' #$sprintteam.name SprintStartDate = "{0:yyyy-MM-dd}"-f $startDate } $Capacities | ConvertTo-Json | Out-File -FilePath "$home\desktop\Capacities.json" get-content "$home\desktop\Capacities.json"
gives this result
{ "ProjectName": "project", "TeamName": "team", "SprintName": "sprint", "SprintStartDate": "" }