Mailbox Archive Tool for Microsoft Exchange Servers

This is another GUI tool based on PowerShell I’ve written in the past. A company I worked for needed a tool for Service Desk people to archive users’ mailboxes into PST file. I’m not an Exchange engineer, they told me they used to use ExMerge in Exchange 2003 environment but since upgraded to Exchange 2007,  they were no longer able to do so under a GUI interface because ExMerge was replaced by a PowerShell cmdlet “Export-MailBox”. So I wrote this mailbox archive tool. it basically archives a mailbox into a PST file (with the option to whether delete mailbox after

Balancing Number of SCOM Agent Per Management Server using PowerShell

I came across a situation yesterday in one of the clients SCOM environment: They currently have a single SCOM management group setup as the following: all SCOM management servers (including the root management server) are located on the same segment of the network. internal agents (from the same forest) are reporting to management server #1 and #2. External agents (from different forests) are reporting to management server #3 and #4 through firewall. SCOM is not integrated to AD – Therefore primary and failover management servers are not automatically assigned to agents. I needed to achieve: agents are evenly distributed to

Get Powershell Execution Policy on remote machines

Today I’ve been asked how to inventory PowerShell execution policies on all servers in a domain. I originally thought I can ultilise RemoteIn as PowerShell V2 should be deployed on all servers. then I realised WSMan wasn’t configured on the srevers so I couldn’t use “New-PSSession” cmdlet… Therefore, I wrote a function called Get-RemoteExecutionPolicy.  It retrieves the setting from the remote registry. The usage is: Get-RemoteExecutionPolicy <machine name>.

ENHANCED SCOM Alerts Notification Emails!

17/08/2012: The version 2 of this script has just been released: http://blog.tyang.org/2012/08/16/scom-enhanced-email-notification-script-version-2/ 29/01/2012: The command notification channel setup section of this blog has been updated. More details of the change can be found HERE: http://blog.tyang.org/2012/01/29/command-line-parameters-for-scom-command-notification-channel/ Please Note: This post and associated script has been updated on 30/09/2010. Even though SCOM is a great product, I personally believe that alert notification emails is something that really needs improvements. It is very hard (and almost impossible – according to my standard) to configure a meaningful notification email using the variables SCOM provides. Most of times, the SCOM administrator would include a URL that takes

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

Morning Check SCOM Alerts – Automated using PowerShell Script

A Powershell script to assist server BAU team to perform morning check using SCOM…

%d bloggers like this: