Category cmd

DB backup script

:: preparing date and time         for /f “tokens=2 delims==” %%a in (‘wmic OS Get localdatetime /value’) do set “dt=%%a” set “YYYY=%dt:~0,4%” & set “MM=%dt:~4,2%” & set “DD=%dt:~6,2%” set “HH=%dt:~8,2%” & set “Min=%dt:~10,2%” & set “Sec=%dt:~12,2%” set…

Send mail from command prompt using powershell

Commands: powershell$EmailFrom = “sendermailID@gmail.com”$EmailTo = “receivermailID1@gmail.com,receivermailID2@gmail.com”$Subject = “The subject of your email”$Body = “This is just a test mail to verify the working of CMD”$SMTPServer = “smtp.gmail.com”$SMTPClient = New-Object Net.Mail.SmtpClient($SmtpServer, 587)$SMTPClient.EnableSsl = $true$SMTPClient.Credentials = New-Object System.Net.NetworkCredential(“sendermailID@gmail.com”, “senderPassword”)$SMTPClient.Send($EmailFrom, $EmailTo, $Subject, $Body)pause

Enable Notifications OK No thanks