Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Formatting Output

Status
Not open for further replies.

fortage

MIS
Jun 15, 2000
329
US
I'm trying to get the following variable and text on one line in the output file but the result is two lines. $Computer[0] is a column in a datatable "filled" from a SQL query. Please advise.

Write-Output $Computer[0]" : Server Name" | Out-File $ReportFile -Append
result two lines
------------
Write-Output $Computer[0]+ " : Server Name" | Out-File $ReportFile -Append
result the "+" character appears in the output file as well
------------
Write-Output "$Computer[0] : Server Name" | Out-File $ReportFile -Append
result System.Data.DataRow[0] : Server Name


 
You could do a for-each $computer write-output...

Or change the out-file -apend to a > outputfile.txt
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top