Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

Scripts result send email

$
0
0

Hi, i need to send email with result of the script.

who help me pls ?

 

the scripts:

$AllVMs = Get-VBRServer -Name "lx1-vi-hpv-cl3", "lx1-vi-hpv-06" | Find-VBRHvEntity -HostsAndVMs

$data = @()

foreach ($VM in $AllVms)

    {$VMBackup = get-vbrjob -Name "NIODO*" | Get-VBRJobObject -Name $VM.Name

        if ($VM.Name -eq $VMBackup.Name)  

            {

                write-host $VM.Name ";" $VMBackup.Type

                $hash = @{

                            VMName = $VM.Name

                            BackupType = $VMBackup.Type

                        }

                $obj = New-Object PSObject -Property $hash

                $data += $obj

            } 

        else {

                write-host $VM.Name ";Unprotected"

                $hash = @{

                                VMName = $VM.Name

                                BackupType = "Unprotected"

                            }

                $obj = New-Object PSObject -Property $hash

                $data += $obj

            }

    }

 

$data | Export-Csv -NoTypeInformation D:\VeeamVMsProtected.csv


Viewing all articles
Browse latest Browse all 6937

Trending Articles