Feb 18

Mail Merge with Attachment

There is not native way to add an attachment when doing an mail merge in Microsoft Office (Outlook/Word/Excel).  However, there are 3rd party apps that allow you to add attachments when doing a mail merge, but these programs usually cost $.  If you’re like me and don’t want to spend money on an application you’ll probably use once, then I came up with an alternative free solution with Powershell.  This method works similar to a Microsoft Office mail merge because it will require a data source, email template, and an Outlook profile.

Step 1 – Create Data Source

I will use a users.csv as the data source of users we want to email.  The users.csv file will look as follows:

FirstName LastName Email Username Password
Joseph smith jsmith@domain.com jsmith VideoGame01
Bill Contoso bcontoso@company.com bcontoso LilyFlower18
Jim Rufus jim.rufus@yahoo.com jrufus StuffedAnimal23

Step 2 – Create Outlook Profile to Send Mail Merge From

Now that you have your data source, you’ll need to make sure you have an Outlook profile.  This profile should be setup with the email address you wish to send the mail merge from.

Step 3 – Create Powershell Script

In the below powershell script, you’ll need to modify the following variables:

$DataSourcePath to the data source (users.csv) file created in step 1
$AttachFile – Path to the file to attach to the email
$EmailSubject – Subject of the email

In addition to modifying the above variables, you’ll need to modify $Mail.Body, which is the body of the email.  The below example is referencing data fields in users.csv for the mail merge, which you may want to modify.  These correspond as follows:

$($_.FIRSTNAME) FIRSTNAME field in users.csv

$($_.LASTNAME) LASTNAME field in users.csv

$($_.USERNAME) USERNAME field in users.csv

$($_.PASSWORD) PASSWORD field in users.csv

Special Note:  To add a new line in the body text use a backtick + n ( `n

Extra Special Note:  If you want to have the email body be HTML formatted instead of Plain Text, just modify $Mail.Body to $Mail.HTMLBody and add your HTML tags in the text.  Using the example above:

 

Step 4 – Send the Mail Merge

Open Microsoft Outlook with the profile created in step 2 (It is required for Outlook to be open in order for the powershell script to work!)  Then open Powershell, and run the powershell script in step 3.  You can confirm the emails are sending by looking in the “Sent Items” in Outlook.

Note: – If you’re using User Account Control (UAC), Outlook and Powershell must be running at the same security level.  This simply means, if you open powershell using “Run as administrator” you must open Outlook with “Run as administrator”.  Alternatively, if you open powershell normally (not elevated) you must open Outlook normally (not elevated).

Feb 11

Removing Trend Micro Client/Server Security Agent from Dell Laptops

Trend Micro Client/Server Security Agent 3.5.1163 Removal from Dell Laptops

OVERVIEW

Some Dell laptops came bundled with “Trend Micro Client/Server Security Agent” which most people will want to uninstall.  I recently had to restore a Dell Latitude E6430 to the Factory Defaults.  When removing the bundled bloatware, uninstalling “Trend Micro Client/Server Security Agent” froze up and I had to kill the process.  Upon rebooting, it was still partially installed.  However, when I tried uninstalling again, Trend Micro was prompting me for a password to uninstall it.  Lots of searching kept leading me to Trend Micro removal tools that just flat out failed.  I started to notice all the removal tools were for WFBS CSA 5.0+, WFBS SA 6.0+, Titanium 2011+, Diagnostic Toolkit, etc….  I looked in Windows Programs and Features and noticed the Trend Micro Client/Server Security Agent Product Version: 3.5.1163 matched nothing I could find on Trend Micro’s website.  After hours of digging, I found a sure fire way to remove this program.  I’ll list some of the “common” solutions below and finish with my guaranteed procedure.

Trend Micro Client/Server Security Agent 3.5.1163

Trend Micro Client/Server Security Agent 3.5.1163

REMOVAL METHOD 1

Uninstalling the Worry-Free Business Security (WFBS) Agent using the Uninstall Tool

  • Download the uninstall tool direct from Trend Micro OR direct from sigkillit.com (In case they pull their copy down).
  • Run SA_Uninstall_1384.exe to extract the files
  • Locate Uninstall.bat and run
    • If you have UAC enabled, right-click and select “Run as administrator”

REMOVAL METHOD 2

  • Open a command prompt
    • If you have UAC enabled, make sure you run it as an elevated command prompt
  • At the command prompt change to one of the following directories depending if you have a 32-bit or 64-bit Operating System
    • 32-bit: C:\Program Files\Trend Micro\Client Server Security Agent\
    • 64-bit: C:\Program Files (x86)\Trend Micro\Client Server Security Agent\
  • Run the following command
    • ntrmv -980223

REMOVAL METHOD 3

If you’re being prompted to supply a password to remove Trend Micro, the following registry edits will disable that prompt.  After the prompt is disabled, you should be able to remove it through Programs and Features without having to supply the password:

  • Open the registry editor
    • Click Start and in the search box enter: regedit
    • Click regedit
  • Open the one of the following registry keys depending if you have a 32-bit or 64-bit Operating System
    • 32-bit: HKEY_LOCAL_MACHINE\SOFTWARE\TrendMicro\PC-cillinNTCorp\CurrentVersion\Misc
    • 64-bit: HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\TrendMicro\PC-cillinNTCorp\CurrentVersion\Misc
  • Locate the DWORD “Allow Uninstall” and change the Value from “0” to “1
    • If it does not exist, you’ll need to create it:
      • Click Edit->New->DWORD (32-bit) Value
      • Name: Allow Uninstall
      • Data: 1
  • Uninstall Trend Micro through Programs and Features and you should no longer get prompted for an uninstall password

REMOVAL METHOD 4 (GUARANTEED TO WORK WHEN EVERYTHING ELSE FAILS!!!)

This method uses a special uninstall tool that’s not publicly listed on Trend Micro’s website.  The tool is not graceful, will throw prompts you need to dismiss, and you’ll probably need to manually close it out.  With that being said, here’s what you need to do.

  • Download the uninstall tool direct from Trend Micro OR direct from sigkillit.com
  • Unzip the exe and when prompted for the password use
    • Password: trend
  • Run WFBSS_UninstallTool_V1106.exe
    • If you have UAC enabled, right-click and select “Run as administrator”
  • Accept the terms and click Next
  • Click Install
    • Keep clicking Retry if prompted to continue the installation.  This will occur multiple times (5 in my case), but keep going
  • The uninstaller will open several prompts including (Click to ignore any prompts you receive and continue)
    • Multiple command prompts
    • Multiple Trend Miro Uninstallation Tool progress windows
      • Wait for the progress bars to stop moving, which can take several minutes
  • After about 10 minutes, you should see no more progress on any of the windows
    • Close all of the command prompt windows
    • The “TrendMicro Uninstallation Tool – Setup” window should now show “Installation Successful”  TrendMicro Uninstallation Tool-Setup Installation Successful
    • Reboot the computer
    • Check in Programs and Features and the Trend Micro Client/Server Security Agent will be gone!