Output file doesn't match Write-Host
问题 When I Write-Host from my .ps1 file I see: Parentfolder >> ChildFolder When I output to a file, I see: ParentFolder >> ChildFolder I am using a simple write-host ($childgroup.name), ">>", ($object.samaccountname) When I try to output the same information using Return , Out-File , Export to CSV , etc... I get 3 lines for what Write-Host prints as a single line . I just want the output file to be in the same format as the Write-Host output. as requested: function getchildgroups($groupname) { #