Page tree

Welcome to FreeSoftwareServers Confluence Wiki

Skip to end of metadata
Go to start of metadata

https://www.varonis.com/blog/powershell-array/

$data = @(
'Zero',
'One',
'Two',
'Three')
ECHO Entire_Array
$data

Add Data to Array

   $UndefinedArgsArr = @()
   $UndefinedArgsArr + @([pscustomobject]@{VarName="$ObjName";VarVal="$_"})
$ArrSize = $data.count
Invoke-Expression $ArrSize > $null
ECHO "Array Size = $ArrSize"
$counter = 0
$data | ForEach-Object {
"ECHO $_ = data[$counter]"
$counter++
}
ECHO Is_One_In_Array?
$data -contains 'One'
$data = @(
       [pscustomobject]@{FirstName='Kevin';LastName='Marquette'}
       [pscustomobject]@{FirstName='John'; LastName='Doe'}
   )
$data | ForEach-Object {
$_
$_.LastName
}
ECHO All_Last_Names
$data.LastName
  • No labels