Announcement

Collapse
No announcement yet.

get-storagecopystatus

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • get-storagecopystatus

    Hi

    I am kind of new to scripting with exchange management shell / powershell and i want to know how to combine 2 commands and export to html/txt/csv and send email.

    for example i want to get the following

    get-storagroupcopystatus of two servers then export results to txt then email results.

    cheers,
    khiko

  • #2
    Re: get-storagecopystatus

    Code:
    Get-StorageGroupCopyStatus  -Server:MBX -DumpsterStatistics | filename.txt
    Should do the trick. Just repeat for the second server and then use some command line email program (such as blat) to e-mail to whoever.

    (Code taken from: http://technet.microsoft.com/en-us/l...EXCHG.80).aspx)
    Server 2000 MCP
    Development: ASP, ASP.Net, PHP, VB, VB.Net, MySQL, MSSQL - Check out my blog http://tonyyeb.blogspot.com

    ** Remember to give credit where credit is due and leave reputation points sigpic where appropriate **

    Comment


    • #3
      Re: get-storagecopystatus

      Hi Tony,

      Thanks for your reply i actually got this script save as .ps1

      get-storagegroupcopystatus -identity "EXCH1\SG1" -StandbyMachine EXCH2
      get-storagegroupcopystatus -identity "EXCH2\SG1" -StandbyMachine EXCH1

      which output the results in the screen.

      now what i want to do is combine the two commands and output results to a txt/html file.

      i already have the script for sending email w/ attachment which is great i just need to basically need the txt/html file.

      also i have this which can send email with attachment

      $FromAddress = "serverFQDN"
      $ToAddress = "destinationEmail"
      $MessageSubject = "MessageSubject"
      $MessageBody = "MessageBody
      $SendingServer = "smtpserver"
      $SMTPMessage = New-Object System.Net.Mail.MailMessage $FromAddress, $ToAddress,
      $MessageSubject, $MessageBody
      $Attachment = New-Object Net.Mail.Attachment(".filename.txt")
      $SMTPMessage.Attachments.Add($Attachment)
      $SMTPClient = New-Object System.Net.Mail.SMTPClient $SendingServer
      $SMTPClient.Send($SMTPMessage)

      Comment


      • #4
        Re: get-storagecopystatus

        Try putting

        Code:
        -DumpsterStatistics | filename.txt
        to the end of each line.
        Server 2000 MCP
        Development: ASP, ASP.Net, PHP, VB, VB.Net, MySQL, MSSQL - Check out my blog http://tonyyeb.blogspot.com

        ** Remember to give credit where credit is due and leave reputation points sigpic where appropriate **

        Comment


        • #5
          Re: get-storagecopystatus

          thanks but i got this...

          Expressions are only permitted as the first element of a pipeline.
          At line:1 char:130
          + get-storagegroupcopystatus -identity "EXCH\SG1" -StandbyMachine EXCH2 -Dumpsterstatistics | test.txt"
          _____________

          i tried the one below and i got the results although the information on the txt file is still not what i wanted

          get-storagegroupcopystatus -identity "EXCH\SG1" -StandbyMachine EXCH2 | Out-File test.txt
          get-storagegroupcopystatus -identity "EXCH2\SG1" -StandbyMachine EXCH | Out-File test.txt -append

          question: how do i get the output i want say "Name" of the server and SummaryCopyStatus?

          thanks for your help

          Comment

          Working...
          X