PowerShell: Send Email


I scheduled a task to send me the every day report by Email. Here is how I did by using PowerShell: $emailFrom = Monitor@test.com$emailTo = jackie.chen@test.com $subject = "Everyday Report"$body = Get-Content C:\Logs\EverydayReport.txt $smtpServer = "SMTP.test.com"$smtp = new-object Net.Mail.SmtpClient($smtpServer)$smtp.Send($emailFrom, $emailTo, $subject, $body)

PowerShell: Send SMS Through Outlook


1) Find a public SMS provider and register an account, there are plenty on the Internet. I use http://www.smsglobal.com in this example, and it works perfect. 2) Install Outlook 2010 and PowerShell on the server. If you use Outlook 2003 or 2007, MOSA has to be installed. 3) Configure Outlook 2010, go to ‘New Item … Continue reading PowerShell: Send SMS Through Outlook

PowerShell: Read Computer Information


Sometimes, I need to check the information of a list of servers. To get it done just in one shot, script is my best choice. Here is a example to check my local machine's info: $Machine = "localhost" $OS = Get-WmiObject -Class Win32_OperatingSystem -ComputerName $Machine $CS = Get-WmiObject -Class Win32_ComputerSystem -ComputerName $Machine $CPU = Get-WmiObject … Continue reading PowerShell: Read Computer Information

PowerShell: Uninstall Software Remotely


I will need to remove a software from more than 30 Windows 2003 servers once I confirmed it has the memory leaking bug. To make the job easier, I prefer to use script (as always): $app = Get-WmiObject -Class Win32_Product -ComputerName (Get-Content servers.txt) | Where-Object {$_.Name -match "Software Name"} $app.Uninstall() NOTE: 1) Win32_Product WMI class is … Continue reading PowerShell: Uninstall Software Remotely

PowerShell: Check Service Status


To ensure the Backup Exec Agent service running OK on each cluster nodes. I created a list to include each nodes and named it as CS_servers.txt, then use the following script to get the status of it. Get-WmiObject win32_service -ComputerName (Get-Content CS_servers.txt) -Filter "name='BackupExecAgentAccelerator'" | select __server,name,startmode,state,status The results are like: __SERVER  : CS-node-01 name      … Continue reading PowerShell: Check Service Status