When I output elements inside an array of an array (example: $data_array[0][0], I only get a char. Why is this? I was expecting a String of LAP-150 for the [0][0] position of this array.
import-module activedirectory
$domain_laptops = get-adcomputer -filter 'Name -like "LAP-150"' -properties operatingsystem, description | select name, description, operatingsystem
$data_array = @()
foreach ($laptop in $domain_laptops){
$bde = manage-bde -computername $laptop.name -status
$encryptionstatus=(manage-bde -status -computername $laptop.name | where {$_ -match 'Conversion Status'})
if ($encryptionstatus){
$encryptionStatus=$encryptionstatus.split(":")[1].trim()
}
else{
$EncryptionStatus="Not Found..."
}
$data_array += ,($laptop.name,$laptop.description,$laptop.operatingsystem,$encryptionstatus)
}
write-output $data_array[0][0]
The output of the above script is just the character "L" which is the first character in the $laptop.name variable. Where am I going wrong? I assume it's something to do with how I'm appending to the array but I've tried different combinations of parenthesis, commas, no parenthesis, etc to no avail.