Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6591345
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T17:24:44+00:00 2026-05-25T17:24:44+00:00

I have a backup log file from robocopy and would like to take last

  • 0

I have a backup log file from robocopy and would like to take last lines from that file and send it as email body.
Log example:

            Total    Copied   Skipped  Mismatch    FAILED    Extras
 Dirs :     85262     85257         1         0         4         0
Files :    637048    637047         0         0         1         0
Bytes :1558.929 g1558.929 g         0         0       165         0
Times :  19:30:49  19:01:06                       0:00:00   0:29:43

Speed :            24448224 Bytes/sec.
Speed :            1398.938 MegaBytes/min.

Ended : Wed Sep 21 15:42:01 2011

Script code:

$report2_tail = Get-Content .\backup2.log )[-12 .. -1]
$encoding = [System.Text.Encoding]::UTF8
Send-mailmessage  -Smtpserver smtp.server.address -encoding $encoding -from "Backup-Replication<backup@mm.com>" -to "mm@mm.com" -subject "End of Replication Report" -body  "
backup Replication Report
------------------------------------------------------------
$report2_tail
"

Script works fine but the message body is in one line and looks like this:

Total    Copied   Skipped  Mismatch    FAILED    Extras      Dirs :     85262     85257         1         0         4         0     Files :    637048    637047         0         0         1         0     Bytes :1558.929 g1558.929 g         0         0       165         0     Times :  19:30:49  19:01:06                       0:00:00   0:29:43      Speed :            24448224 Bytes/sec.     Speed :            1398.938 MegaBytes/min.      Ended : Wed Sep 21 15:42:01 2011

What is a best way to solve the problem ?
Regards
Marcin

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T17:24:44+00:00Added an answer on May 25, 2026 at 5:24 pm

    Pipe Get-Content result to the Out-String cmdlet:

    $report2_tail = Get-Content .\backup2.log )[-12 .. -1] | Out-String
    Send-mailmessage ... -subject "End of Replication Report" -body $report2_tail 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got log file, which I would like to have 60 lines in. When
I have an Oracle database backup file (.dmp) that was created with expdp .
Perl newbie here. I have a log file that I need to parse out
I have an INI file that I want to read the line DeviceName=PHJ01444-MC35 from
I have a backup script that calls SVN dump, outputs stderr to a file
Have made backup script that does well: makes backup zip-file and then uploads it
I am using a Send-MailMessage function to email the log files of a backup.
How can you find out what transaction log backup files have been restored using
I have a backup server that automatically backs up my live site, both files
I have encapsulated a backup database command in a Try/Catch and it appears that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.