i am currently using:
$emailFrom = "[email protected]"
$emailTo = "[email protected]"
$subject = "subject"
$body = "message"
$smtpServer = "mail.host.com"
$smtp = new-object Net.Mail.SmtpClient($smtpServer)
$smtp.Send($emailFrom, $emailTo, $subject, $body)
and i know that with the folowing command i can find out the free space on all of my hdd:
Get-WmiObject WIN32_logicaldisk | sort -desc freespace | select -first 3 | format-table -autosize deviceid,devicetype,providername,freespace,size,volumename;
when i try to do this:
$body = Get-WmiObject WIN32_logicaldisk | sort -desc freespace | select -first 3 | format-table -autosize deviceid,devicetype,providername,freespace,size,volumename;
but all i get in my email is the folowing:
Microsoft.PowerShell.Commands.Internal.Format.FormatStartData Microsoft.PowerShell.Commands.Internal.Format.GroupStartData Microsoft.PowerShell.Commands.Internal.Format.FormatEntryData Microsoft.PowerShell.Commands.Internal.Format.FormatEntryData
Microsoft.PowerShell.Commands.Internal.Format.FormatEntryData Microsoft.PowerShell.Commands.Internal.Format.GroupEndData Microsoft.PowerShell.Commands.Internal.Format.FormatEndData
how can i get my free space via email using powershell???