How to list Variables for a script using Windows 7 laptop?

by Jul 2, 2014


I admit that I am a "rookie" when it comes to PowerShell.  But I am
hungry, and wanting to learn more.  I have a thick, cumbersome
PowerShell reference book here, but I am struggling to learn even the
basic stuff. 

So please forgive me for my following question.

I have the following script below.  My goal is to:


a.) list the variables in the following script;

b.) define the Purpose of the following script.



$WMI = Get-WMIObject -Computer localhost -Class Win32_DiskDrive
$building = "URGENT Disk Report `n`n"
$allclear = ""
ForEach ($Drive in $WMI){
    $building += $Drive.Caption + ": " + $Drive.Status + "`n"
    if ($Drive.Status -ne "OK") { $allclear = "N" }
$date = Get-Date
$building += "`nExecuted at " + $date

if ($allclear -eq "N") {

$EmailFrom = "EMAIL ADDRESS"
$SMTPServer = ""
$SMTPClient = New-Object Net.Mail.SmtpClient($SmtpServer, 587)
$SMTPClient.EnableSsl = $true
$SMTPClient.Credentials = New-Object System.Net.NetworkCredential("USERNAME", "PASSWORD");
$SMTPClient.Send($EmailFrom, $EmailTo, $Subject, $building)
else { Write-host "No Issues Detected" }



any help would be greatly appreciated.