Hi,
I am using pieces of someone else’s script I came across. The goal of the script is to search AD to see if an account exists. Long story short, my question is about output and objects. In the script, the output to screen for each item is done like this:
if (!($ADResult)) {
$HashProps = @{
‘HomeDir’ = $_.FullName
‘AccountName’ = ‘None’
}
Output the object to the screen
New-Object -TypeName PSCustomObject -Property $HashProps
However, I need to put that information into a csv file from within the script. I don’t understand the custom objects, and though I have been researching this, I cannot figure out how to get the result I am looking for. The HomeDir and Accountnames should be headers in a csv file. I want the output to be done in the script.
Would someone please help me with this? I would really appreciate it!