Forum Discussion
Récupération données Active Director
Hello,
Please can you help me ?
Regards
- AndySvintsNov 09, 2020Iron ContributorWould you be so kind to provide more details?
You are running same code from ISE and Console and receive different results?
Are you running script directly from Domain Controller or from domain joined computer/server?
What the business goal /use case?
Get Bitlocker password for computers from Ad?
Get data for report/for backup or for processing?- Mike9375Nov 10, 2020Copper Contributor
AndySvints
Hi,I try my code on ISE and also with the console and i have the same results.
The problem is when i want export the data with Export-csv. The bitlocker data is not present in my csv file. But the others AD data is present (lastlogon, enabled, Distinguishedname...).
When i try my code outside of my principal script. It's working.
I try this code:
cls $ADComputersSource = Get-ADComputer -Server carmignac -Filter * -Properties * $tabbitlocker=@() foreach($computer in $ADComputersSource){ $tab = New-Object psobject $tab | Add-Member -Name "Bitlocker Recovery" -MemberType NoteProperty -Value $computer.'ms-Mcs-AdmPwd' -Force $tabbitlocker+=$tab } $tabbitlocker | Export-Csv -Path ".\test.csv" -NoTypeInformation -Delimiter ";"
This code is working but... when i had this code in principal script... it's not working and in my csv file, i don't have any informations for bitlocker.
the goal is to create a report on PCs with a Bitlocker key on the AD for Projet Manager.
Regards.
- AndySvintsNov 10, 2020Iron Contributor
Mike9375 ,
Oh I see.
So the code snippet you provided above is getting you the expected result. The problem is that when you have this piece of code in you main script it is not throwing you the error but providing empty csv column for the Bitlocker info.
Based on the me of variables in your initial question your main script is presenting GUI. Is it possible to show a little bit more code from the main script?