troubleshooting Question

How to dump output to csv file

Avatar of rdefino
rdefinoFlag for United States of America asked on
Powershell
3 Comments1 Solution118 ViewsLast Modified:
I have the script below that runs fine, but I cannot get it to dump to a csv file. the output file is created, but it's empty. What am I missing?

Get-Content E:\rdefino\verify_alias\aliases_list.txt | % {$proxy = "smtp:"+$_.tostring().trim(); if(Get-ADObject -Filter {proxyaddresses -eq $proxy} ) {Write-Host "Found: $proxy"} else {Write-Host "Not Found: $proxy"}} | Export-Csv  E:\rdefino\verify_alias\alias_output.csv
ASKER CERTIFIED SOLUTION
Chris Dent
PowerShell Developer
Join our community to see this answer!
Unlock 1 Answer and 3 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros