Turncated Issue on outfile

Please understand that I am in the process of learning Powershel.
Thank you

$comments = @’

Purpose: How Export Users Contacts for Email Migration
#New-Item c:\myscripts\output -type directory
New-Item \x.x.x.x\backupemail\users$strname -ItemType directory
New-Item \x.x.x.x\backupemail\users$strname\contacts -ItemType directory
$Outlook=NEW-OBJECT –comobject Outlook.Application


$Contacts | Format-Table FullName,CompanyName,JobTitle,FileAs,Email1Address,WebPage,IMAddress,BusinessTelephoneNumber,BusinessFaxNumber,MobileTelephoneNumber,BusinessAddress | out-file \x.x.x.x.\backupemail\users$strname\contacts\contacts.txt

Out-File presents information basically exactly as it would show up at the console (including using the same console width, if I remember correctly.) If you want to allow really long lines in the file, you can pass a large value to Out-File’s -Width parameter. Or, alternatively, you could use something like a CSV file instead. The difference there would be whether you intend for a script or program to read this data later, or if it’s meant to be more readable for people instead. Format-Table produces a human-readable format, but one that would be very annoying to have to read in with a script. CSV is intended for programs and scripts to parse, and can be opened directly with programs like Microsoft Excel.

out-file \\x.x.x.x.\backupemail\users\$strname\contacts\contacts.txt -Width 100000

Thank you for the wealth of information. You are correct I will want to read the data back in after.
So If I am understanding this correctly I should be changing this line to something else to import the information back in later.

$Contacts | Format-Table FullName,CompanyName,JobTitle,FileAs,Email1Address,WebPage,IMAddress,BusinessTelephoneNumber,BusinessFaxNumber

Yep. Instead of Format-Table, you would use Select-Object, and then pipe the results to Export-Csv instead of Out-File. That would allow you to use Import-Csv on the file later (or to open it with Excel.)

In this example, I’ve split the command into multiple lines to make it a bit easier to read:

$properties = 'FullName','CompanyName','JobTitle','FileAs','Email1Address','WebPage','IMAddress','BusinessTelephoneNumber','BusinessFaxNumber'

$Contacts |
Select-Object -Property $properties |
Export-Csv -NoTypeInformation -Path \\x.x.x.x.\backupemail\users\$strname\contacts\contacts.csv

Thank you for the code. I will take a look at this in 30 min or first thing tomorrow.