Skip to main content


Outlook VBA get address book names

How to get Outlook address book names via VBA?
Outlook has the option to create multiple address books. Of course, it's for a good reason, to organize address books.
Well, why need to organize? I guess the reason will depend on every individual whether it's a thing to practice or a thing to be ignored.
Outlook address book can be set to manage contacts.
For example, you can have an address book just for Personal use which includes friends and family.
You can set the address book for vendors and another address book for customers only and of course contacts within the organization.
Organizing is a skill if not an attitude to make work easier and manageable.
VBA code below will get all the address book names on Outlook, and once the address book is known you can expand the code to get contacts for each specific address book by supplying the address book name.
====================================== Sub getfoldercontact_addressbook_names()

Dim mContact As AddressList
Dim mAddressBook…

PowerShell send csv content via email

A simple PowerShell code snippet to send contents of a csv file to an email.
It can be used to send a reminder with the contents type on the csv file. 

The code below can also be used to send reminders to customer or promotion emails which only need text files.
Or got logs on a server or applications, but the code below will need to be modified to follow the format of the logs.
The code below requires PS 5.0.
Tweak the code to suit CSV format; format used below is for demo purposes.
From what I observed PowerShell reads the code from the last column with contents to the first column of the excel sheet.
The code below uses this CSV format.
Highlighted text below is column headers in the CSV file, which is defined as an array on PowerShell script.
ToxSubjectxBodyxuser1_tech@myemail.comPC ReminderTurn off PC @ 5PMuser2_tech@myemail.comServer ReminderReboot Server @ 12:30am
From above contents of CSV, PowerShell is able to send out multiple emails and contents base on the data on the CSV.

If  the…

PowerShell split and join string

How to split a string by space using PowerShell?
PowerShell provides an easy way to do it using "split" method in PowerShell.
The split method accepts any delimiter; it can be space, dash, comma or other characters as long as it has a pattern on the string.
The split method will literally split the string and the output is displayed on a separate line or separated via a line feed.
$string = "This is my test string"
$split_string_array = $string -split " "
Output will be: This
If there is a need to remove the spaces but combine the string in one line, PowerShell also provides the "join" method which basically combine or joins the string in one line.
Example: $string = "This is my test string"
$split_string_array = $string -split " "
$join_string_array = $split_string_array -Join ""
Write-Host $join_string_array
Output: Thisismyteststring
Using the join method, a string can be manipu…

Check User SID

To check the SID for a user whose profile is not currently login using WMIC, type: wmic useraccount where (name="user007") Replace "user007" with the correct username to get the user SID.
The SID will be displayed for that particular user being queried. This will be useful if the profile for that particular user cannot be loaded or corrupted and need to identify the SID for the corrupt user profile.
Editing the registry for corrupt user profiles must edit the correct SID or else multiple issues might occur to the system.

To check the SID of a currently login user; just open a command prompt and type:
whoami /user
The command above will display the username and SID of the currently login user.
To check for FQDN (Fully Qualified Domain Name):

   whoami /fqdn
The FQDN is useful for System Administrator to check which OU (organizational unit) the user belongs to.

To check the UPN (user principal name):

   whoami /upn

UPN output will be shown like an email address, the use…