PowerShell Script: Mass-Mailer

Today a colleague asked me to write a script to send out a email to a large group of people but have the phrase “Dear <person’s name”>” in the beginning of email body. I quickly wrote this script. Here are the steps you need to take before executing it: 1. Zip and place the Mass-Mailer folder somewhere on your computer. There are 3 files in the folder: 2. in Mass-Mailer.ps1 file, modify the highlighted section ( and remove the “<” and “>”brackets): 3. Open recipientsList.txt and enter recipients name and emails, one recipient per line with format Name;Email (i.e. John

How To Write to SCOM Operations Manager Event Log Using PowerShell and MOM.ScriptAPI

The following commands can be executed using the normal PowerShell console. SCOM PowerShell snapin is not required. $momapi = New-Object -comObject "MOM.ScriptAPI" $momapi.LogScriptEvent("test",9999,2,"this is a test")   This is the log:   Detailed documentation of MOM.ScriptAPI can be found on MSDN.

PowerShell Script: Test-SMTP

I wrote this simple script last week to test SMTP server by sending a testing email. Usage: .\Test-SMTP.PS1 -smtp smtp.xxxx.com -port 25 -from test@xxxx.com -to recipient@xxxx.com If the email is successfully, the recipient will receive an email similar to this: The email contains the following information: Originating Computer: Where the script was run from SMTP Server Address: The SMTP server that sent this email SMTP Server Port: default SMTP port is 25 Return (sender) address: This does not have to be a real address Recipient: Where the email is sent to.

PowerShell Script: Setting NTFS Permissions in Bulk

Today I wrote this PowerShell script to apply a same set of NTFS permission for a particular user or group to a list of folders. It reads the list of folders from a file that is specified from a parameter, apply the permission which is also specified  from parameters. The useage is as follow: .\BulkSet-NTFSPermissions.ps1 -FolderListFile x:\xxxx\xxxx.txt -SecIdentity “Domain\Group” -AccessRights “FullControl” -AccessControlType “Allow” FolderListFile: a flat text file containing the list of path that need to apply the NTFS permission. It needs to list one folder per line. the path can be a absolute local path such as C:\temp or a UNC path

Windows Scheduled Tasks inventory – Using PowerShell

I originally posted this script here. It is to audit and inventory all scheduled tasks created for all windows computers under a specific OU in AD. It has become useful for me again this week while I was working on a client’s SCOM environment. This particular client had no control over scheduled server reboots and they are not using SCOM Maintenance mode at all. Therefore there are a lot of SCOM alerts generated… This script came in handy and it’s a good starting point to get all scheduled tasks and find out which ones are causing servers to reboot so

%d bloggers like this: