I’m really new with PowerShell, and I’m trying to do what seems like a very simple task but for the life of me cannot wrap my head around the behavior.
All I am trying to do is connect to one of our VCenter servers, query the datastore information and send the output to us via email.
- $datastore = get-datastore
- Send-MailMessage -To email@example.com -From firstname.lastname@example.org -Subject Test -BodyAsHTML -Body "$datastore" -SmtpServer email@example.com -Credential DOMAIN\UserID
Can anyone see what I’m missing from my 2 lines here? Any help would be appreciated.