Script – Send a Message to Employees Celebrating their Work Anniversary

I have posted this on Spiceworks but figured I should post it here as well.

#Thanks to the following sources
#1 https://www.cgoosen.com/2015/04/user-powershell-to-bulk-email-your-users/
#2 https://community.spiceworks.com/topic/1332314-automatic-birthday-reminder-script-issues-powershell

# Define local Exchange server info for message relay. Ensure that any servers running this script have permission to relay.
$ExchangeServer = "mail.yourdomain.com"
$SMTPPort = "25"
$FromAddress = "AnniversaryTeam <AnniversaryTeam@yourdomain.com>"

# Function to create report email
function SendNotification{
 $Msg = New-Object Net.Mail.MailMessage
 $Smtp = New-Object Net.Mail.SmtpClient($ExchangeServer, $SMTPPort);
 $Msg.From = $FromAddress
 $Msg.To.Add($ToAddress)
 $Msg.Subject = "Happy Anniversary!"
 $Msg.Body = $EmailBody
 $Msg.IsBodyHTML = $true
 $Smtp.Send($Msg)
}

# Import user list and information from .CSV file and get today's date
$Date = Get-Date
$Users = Import-Csv C:\Scripts\Anniversary.csv
 
# Send notification to each user in the list whose anniversary is today
Foreach ($User in $Users) {
if ($Date.Day -eq $User.Anniversary_day -and $Date.Month -eq $User.Anniversary_month) {
 $ToAddress = $User.Email
 $Name = $User.FirstName
 $EmailBody = @"
 <html>
 <head>
 </head>
 <body>
 <p>Dear $Name,</p>
 
 <p>Today is your work anniversary! We appreciate you! Now, get back to work!</p>
 
 <p>Regards,</p>
 
 <p>Anniversary Team</p>
 </body>
 </html>
"@
 Write-Host "Sending notification to $Name ($ToAddress)" -ForegroundColor Yellow
 SendNotification
}
}

Viewing Delegates using PowerShell

I received a call from my boss wanting to make sure that no one is a delegate on the CEO’s mailbox.

I had to verify if there are any delegates assigned to the mailbox by running this command:
Get-CalendarProcessing -identity “Mister CEO” | select-object ResourceDelegates

I then removed the delegates using this command:
Get-Mailbox -identity “Mister CEO” | Set-CalendarProcessing -ResourceDelegates $null

Afterwards, I re-ran the first command to make sure that the delegate has been removed.

Logitech Unifying Software for Ubuntu

Logitech does not have an official Unifying software for Linux. However, a simple Google search will take you to Solaar.

Solaar is a Linux device manager for Logitech’s Unifying peripherals and as I have learned since switching to Ubuntu, installation could not get any easier.

To install Solaar in Ubuntu, launch terminal and run the following command: sudo apt-get solaar-gnome3

Once installed, launch the application. It will prompt you if the Unifying receiver is plugged in when the software was being installed and will ask you to unplug it and plug it back in for the application to work properly.

Solaar automatically detects if there are any devices already paired with the receiver. If you need to pair a new device, highlight Unifying Receiver and click the Pair new device button. After a second or two, the device will appear in the list on the left and you are all set.

The user interface of the official Unifying software for Windows becomes convoluted compared to Solaar’s. Logitech can definitely learn something from this software.

Lab using VMware Workstation

Goal: Build a foundation for a Windows infrastructure using VMware Workstation

Hardware: I have a 3-year-old desktop with an Intel Core i7-3770 at 3.40 GHz, 32 GB of RAM, running Windows 10 Pro 64-Bit that I will be using.

Now this desktop only has one Ethernet port so as far as network settings in VMware Workstation, I will be using LAN Segments instead of the built-in Host-only or NAT. Before I go into the network settings in Workstation, let me give you an idea on how I build my VMs.

Currently, I have “templates” in VMware Workstation. Basically, I installed the OS, configured the basic settings (e.g., time zone, IE enhanced security configuration, etc), ran sysprep.

As you can see from the screenshot, I have a naming convention. It makes things organized especially if you would like to test different operating systems. Once the template has shut down after its sysprep, I go to the VM’s Snapshot Manager.

In Snapshot Manager, I take a snapshot of the VM. That snapshot then becomes the template. This template is what I use to create a linked clone. The desktop I am using only has 250 GB of disk space and a linked clone requires less disk space because it is a reference to the original virtual machine. The downside is that the linked clone cannot run without access to the original VM.

On the virtual machine that will act as a domain controller, I use two network adapters. One is assigned as a LAN segment. If it’s your first segment, creating a new one is as simple as typing a filename. In my case, I use the domain and a subnet as the name of the segment.

The second network adapter is set as a Bridge. This way, my VM will have access to the internet. I opted to use a LAN segment because VMware Workstation will only allow 1 NAT network. So to spice things up, instead of opting for a host-only network, I selected a LAN segment to play around with DHCP and RRAS or another software-based router.

On the next part of this series, I will discuss creating an Active Directory infrastructure.

Update Ubuntu 16.04 from Terminal

In Windows, most users go to Windows Update from Control Panel to check for updates and install new patches from Microsoft. There is a command-line option which is: wuauclt.exe /detectnow /updatenow but I personally only use it when testing WSUS.

In Ubuntu 16.04, there are 2 easy ways that I am aware of to run and install updates (and as a reminder, I am a Linux newbie, so there could be a lot more ways).

1: sudo apt-get update

2: sudo apt update

The difference being is the apt tool. “apt-get” is an old command, apt is the new one released in 16.04. There is an in-depth explanation of the difference between these commands over at maketecheasier.com.

Screenshot in Ubuntu

I recently started using Ubuntu as my primary operating system at home and this afternoon, I needed to take a screenshot of something on my screen. Thankfully, I don’t need to download an application to be able to do so.

To take a screenshot of the whole screen, press the Print key.

To take a screenshot of the active window, press Alt + Print keys.

To take a screenshot of an area, press Shift + Print keys.

Take note that I am using Ubuntu 16.04. I have not tried this on other versions.

Another tech blog.

This blog/domain was born from looking at my cheat sheet in Evernote. I have collected quite a few pages worth of tips and tricks throughout my career in IT. It is time to share those publicly in hopes that someone may find them useful.

I am not much of a conversationalist, written or otherwise, so please do not expect paragraphs after paragraphs on my posts. The focus of this blog will revolve around my daily experience as a systems administrator. There will be issues and fixes similar to other blogs. Nothing unique, just another blog in the crazy world of the internet.

That’s it for tonight. Later.