guys. I writing a simple powershell script, and have strange behaviour of returning value.
function get-ResourcesForCsv {
param([string]$Container)
$Groups = Get-ADGroup -filter * -SearchBase $Container |
select-object Name | where-object { $_.Name -notlike "*`$All*" }
$Resources = @()
foreach( $Group in $Groups ) {
$Group.Name -match "((\w+)_)(.+)(_([RW]))"
$Resource = @{
Name = $Matches[3]
Access = $Matches[5]
Group = $Group.Name
}
$Resources += New-Object PSObject -Property $Resource
}
write-host $Resources # Here's ok
$Resources
}
function get-ResourcesForHtml {
param([string]$Container)
$Temp = get-ResourcesForCsv $Container
write-host $Resources # Here's things goes terrible
...
}
When i check $Resources value - it's ok, when i check $Temp - size is doubled, and array contains a lot of "True" at the begining.
P.S. Sorry for my terrible english ((