Quantcast
Viewing all articles
Browse latest Browse all 231085

Re: PoweCli Script to Export Snaphost Details of Multiple VCs

Hi Vrad6841,

        When i am running the below script from schedule tasks, it doesn't show any error and only blank csv file is getting generated. Does the script need modification like interactively in 2008 ?

Also,its doesn't prompt for vcenter pasword after running the schedule tasks. It seems its not connecting vcenter server after running the script.

 

 

$vcenters = "VC1"

$cred1 = get-credential

 

  foreach ($vcenter in $vcenters){

     connect-viserver $vcenter -credential $cred1

     get-vm | get-snapshot | select vm, sizegb, created, description, name | Export-CSV D:\Script\test\Snapshot.csv -append -notype

     disconnect-viserver $vcenter -confirm:$false

     }

 

$mailto = 'mail.com'

$mailfrom = 'sendermail'

$mailsubject = 'Snapshot_Report'

$smtpserver = 'smtp server'

$mailbody = "Snapshot Reminder"

$attach1 = "D:\Script\test\Snapshot.csv"

Send-MailMessage -To $mailto -From $mailfrom -Subject $mailsubject -SmtpServer $smtpserver -Body $mailbody -Attachments $attach1

 

 

your help is much appreciated.

 

thanks

vm2014


Viewing all articles
Browse latest Browse all 231085

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>