1 2 3 Previous Next 36 Replies Latest reply on Apr 6, 2020 4:28 AM by LucD

    Invoke multiple vcenters from rvtoolsbatch

    afhamsani Novice

      Hi guys,

       

      Can you please help how i can be possible called upon multiple vCenters from rvtoolsbatch and will send all it all as different attachment but in a single mail?

       

      From what i read on rvtools documentation, it was suggesting to use a colon as a separator, but i couldnt get like what i want to have and Keep getting error Unhandled exception: Invalid URI: The hostname could not be parsed.

       

      I can write multiple lines to invoke multiple vcenters and send email or attachment likewise, but that would beat a purpose as i wanted to have all rvtools report of all vcenters in a single email.

       

      Please help.

       

      Cheers

        • 1. Re: Invoke multiple vcenters from rvtoolsbatch
          LucD Guru
          Community WarriorsvExpertUser Moderators

          Try something like this

           

          $ExportPath = 'C:\Temp'

          $Servers = 'vcenter1','vcenter2'

           

          $Servers | %{

          . "C:\Program Files (x86)\Robware\RVTools 3.9.3\RVTools.exe" -passthroughAuth -s "$($_)" -c ExportAll2xls -d "$($ExportPath)" -f "RVTools-$($_)"

          }

           

          $smtpServer = 'mail.lucd.info'

          $to = 'lucd@lucd.info'

          $from = 'lucd@lucd.info'

           

          $att = Get-ChildItem -Path $ExportPath -Filter RVTools*.xlsx | select -ExpandProperty FullName

           

          Send-MailMessage -SmtpServer $smtpServer -Subject 'RVTools reports' -To $to -From $from -Attachments $att

           

          Blog: http://lucd.info | Twitter: @LucD22 | PowerCLI Reference co-author: http://tinyurl.com/hkn4glz
          3 people found this helpful
          • 2. Re: Invoke multiple vcenters from rvtoolsbatch
            afhamsani Novice

            LucD,

             

            Worked as charm but since it is calling upon many vcenters and takes much time, it cannot send the email when the spreadsheet isnt ready.

             

            So i just put command start-sleep -s 300 before the following syntax. thanks LucD!

             

            $att = Get-ChildItem -Path $ExportPath -Filter RVTools*.xlsx | select -ExpandProperty FullName

             

            Send-MailMessage -SmtpServer $smtpServer -Subject 'RVTools reports' -To $to -From $from -Attachments $att

             

             

             

            1 person found this helpful
            • 3. Re: Invoke multiple vcenters from rvtoolsbatch
              Navi9 Lurker

              Hi All,

               

              where do I execute from ?

               

              I am new to this technology domain, so, please guide me.

               

              1. I am able to login to vSphere web client and have an overview of all the 6 vCenters in the environment

              2. I have to log into RV tool for each individual vCenter and then, extract the report dump.

               

              So, how do I execute the listed script and where, in which environment ?

               

              Considering I have a restricted client Citrix desktop environment, where I have may have to execute this.

              • 4. Re: Invoke multiple vcenters from rvtoolsbatch
                Navi9 Lurker

                I get this error message on this forum page:

                 

                The request could not be validated as originating from within the SBS application

                The request could not be validated as originating from within the SBS application

                 

                 

                 

                Please advie that what does that mean, am I doing something wrong ?

                • 5. Re: Invoke multiple vcenters from rvtoolsbatch
                  LucD Guru
                  Community WarriorsUser ModeratorsvExpert

                  No clue to be honest.

                  From where, and how do you start the script?

                  Blog: http://lucd.info | Twitter: @LucD22 | PowerCLI Reference co-author: http://tinyurl.com/hkn4glz
                  • 6. Re: Invoke multiple vcenters from rvtoolsbatch
                    AyoubSouihel Novice

                    hi LucD,

                     

                    thank you !! please to customize the report to be saved on a local directory

                    • 7. Re: Invoke multiple vcenters from rvtoolsbatch
                      LucD Guru
                      User ModeratorsvExpertCommunity Warriors

                      That is what the $exportPath variable is doing.

                      Or do you mean something else?

                      Blog: http://lucd.info | Twitter: @LucD22 | PowerCLI Reference co-author: http://tinyurl.com/hkn4glz
                      • 8. Re: Invoke multiple vcenters from rvtoolsbatch
                        hapip87 Enthusiast

                        getting the following error

                         

                        Send-MailMessage : Cannot validate argument on parameter 'Attachments'. The argument is null or empty. Provide an

                        argument that is not null or empty, and then try the command again.

                        At line:27 char:102

                        + ... VTools reports' -To $to -From $from -Attachments $attachment.Fullname

                        +                                                      ~~~~~~~~~~~~~~~~~~~~

                            + CategoryInfo          : InvalidData: (:) [Send-MailMessage], ParameterBindingValidationException

                            + FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.PowerShell.Commands.SendMailMessage

                        • 9. Re: Invoke multiple vcenters from rvtoolsbatch
                          LucD Guru
                          Community WarriorsvExpertUser Moderators

                          I suspect you might be running the script against VCSA 6.5 (or higher)?
                          In that case passthroughAuth does not work, and you will have to use the -u and -p parameters instead.
                          See RVTools not working with VCSA 6.5 (TLS 1.0 is disabed)

                          Blog: http://lucd.info | Twitter: @LucD22 | PowerCLI Reference co-author: http://tinyurl.com/hkn4glz
                          • 10. Re: Invoke multiple vcenters from rvtoolsbatch
                            Jaiprathop Lurker

                            Below is the error for long time now upon repeated tries, seems the ps error or refers to some other. Pl help.

                             

                            The term 'C:\Program Files (x86)\Robware\RVTools 3.9.3\RVTools.exe' is not

                            recognized as the name of a cmdlet, function, script file, or operable

                            program. Check the spelling of the name, or if a path was included, verify

                            that the path is correct and try again.

                            At line:9 char:3

                            + . "C:\Program Files (x86)\Robware\RVTools 3.9.3\RVTools.exe" -passthr ...

                            +   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

                                + CategoryInfo          : ObjectNotFound: (C:\Program File...9.3\RVTools.e

                               xe:String) [], CommandNotFoundException

                                + FullyQualifiedErrorId : CommandNotFoundException

                            $ExportPath = 'C:\Temp'
                            $Servers = 'vcenter-dev'

                            $Servers | %{
                            . "C:\Program Files (x86)\Robware\RVTools 3.9.3\RVTools.exe" -passthroughAuth -s "$($_)" -c ExportAll2xls -d "$($ExportPath)" -f "RVTools-$($_)"
                            }

                            $smtpServer = 'mailserver.amat.com'
                            $to = 'JaiPrathop_Sadasivam@amat.com'
                            $from = 'JaiPrathop_Sadasivam@amat.com'

                            $att = Get-ChildItem -Path $ExportPath -Filter RVTools*.xlsx | select -ExpandProperty FullName

                            Send-MailMessage -SmtpServer $smtpServer -Subject 'RVTools reports' -To $to -From $from -Attachments $att

                            • 11. Re: Invoke multiple vcenters from rvtoolsbatch
                              LucD Guru
                              User ModeratorsvExpertCommunity Warriors

                              Is that the folder where you installed RVTools?

                              Blog: http://lucd.info | Twitter: @LucD22 | PowerCLI Reference co-author: http://tinyurl.com/hkn4glz
                              • 12. Re: Invoke multiple vcenters from rvtoolsbatch
                                sushilkm Enthusiast

                                LucD

                                 

                                So i am adopting this script and i am using exactly same way except for that i am using encrypted credentials.

                                 

                                Q - How do i ensure that files are deleted post Sending the mail. I fear this might fill up the disk post

                                • 13. Re: Invoke multiple vcenters from rvtoolsbatch
                                  LucD Guru
                                  vExpertUser ModeratorsCommunity Warriors

                                  The vCheck script doesn't have this 'cleanup' feature builtin at the moment.

                                  You will have to do the cleanup your self in a script.

                                   

                                  By default the files are created in $env:Temp. but you can change that with the OutputPath parameter.

                                  Blog: http://lucd.info | Twitter: @LucD22 | PowerCLI Reference co-author: http://tinyurl.com/hkn4glz
                                  1 person found this helpful
                                  1 2 3 Previous Next