Author: Abe

Python Math Game

This is a program I made for my daughter to sharpen her multiplication skills. This program is a multiplication quiz game that asks the player 10 random multiplication questions. The game tracks the number of correct and incorrect answers, records how long the player takes to answer each question, and saves the results in a text file called multiplication_results.txt.

She enjoys playing with this program even if it is just a plain text game. Below is the source code of version 1. If you want a copy of the program leave a comment below. Stay tuned for the next version, which is coming soon!

Read more

Updating Active Directory User Data

The Situation

Adding new employee user accounts, updating their information when changes occur, and deleting accounts when employment ends are straightforward tasks in Windows Active Directory—if you’re only managing a small number of changes at a time.

However, this simplicity becomes a challenge as the number of employees grows, as we’ve experienced at work. Over the years, our employee count has increased, leading to a corresponding rise in domain users. Additionally, every employee requires access to a domain computer to perform their work. On top of that, we also need to create user accounts for interns, volunteers, and contractors, and managing their access status further complicates things.

To make matters worse, we have a limited number of IT staff and a restricted IT budget, as our organization is a non-profit. Therefore, I need to find a solution to manage this aspect of our work more efficiently.

Here’s What I Did in This Situation

I recognized that finding better ways to manage our user list was a significant project for us, but I was confident that once completed, it would bring substantial long-term benefits to the department. The first step I took was to examine our HRIS (Human Resources Information System) and AD (Active Directory), comparing the information in AD with what we had in our HRIS.

One issue I noticed was that the employee ID number had never been entered into AD. I understood that this would be the first thing I needed to address. I needed a unique key for this project, and the EIDN (employee ID number) served this purpose perfectly.

To begin, I created a local folder on my computer and prepared a CSV file with the following columns:

  • SamAccountName
  • EmployeeID
  • Department
  • ManagerSamAccountName

Next, I wrote a PowerShell script to generate a CSV file in this format. I also created a corresponding report in our HRIS with the following columns:

  • Username
  • EmployeeID
  • Department
  • Manager
Get-ADUser -Filter {Enabled -eq $true} -Properties EmployeeID, Department, Manager |
Select-Object Name,SamAccountName,EmployeeID,Department,Manager |
Sort-Object Name |
Export-Csv -Path "C:\psLogs\EmployeeList-AD-result.csv" -NoTypeInformation

Using MS Excel, I populated the CSV file with the necessary information. I used the VLOOKUP function in this task.

Then I created this script that will import the CSV file and update the Active Directory.


Import-Csv -Path "C:\psLogs\EmployeeList-AD.csv" |
ForEach-Object {
$managerDN = (Get-ADUser -Identity $_.ManagerSamAccountName).DistinguishedName
Set-ADUser -Identity $_.SamAccountName -EmployeeID $_.EmployeeID -Department $_.Department -Manager $managerDN

}
<h1>Use this if you want to export results into a csv file.</h1>
Get-ADUser -Filter {Enabled -eq $true} -Properties EmployeeID, Department, Manager |
Select-Object Name,SamAccountName,EmployeeID,Department,Manager |
Sort-Object Name |
Export-Csv -Path "C:\psLogs\EmployeeList-AD-result.csv" -NoTypeInformation

Now that I have the EID of employees I can easily compare our current employee list with our active AD user list.

Life of an IT Professional.

I have been in the IT profession for a long time. This series of posts covers various scenarios I’ve encountered and how I tackled each one. It’s not intended to prescribe how things should be done, but rather to serve as a personal journal of my IT work. Also, I’m grateful for the internet and the many people who generously share their knowledge. That’s why I’m creating this series—to give back to the community by sharing my life experiences as an IT professional.

If you stumble upon our website and have questions about my posts, feel free to leave a comment below.

Custard Dessert

Our family loves custard-filled pastries like cream puffs, custard-filled donuts, and eclairs. My wife shared her egg custard pie recipe back in 2013. To satisfy the craving we usually go to nearby Krispy Kreme and buy their chocolate iced custard-filled donuts.

Ingredients

3 egg yolks
45 grams of sugar or 5 1/2 packets of Truvia
10 grams of cornstarch
300 mL of whole milk
5ml of vanilla extract
1 pinch of salt

Procedure

SonicWall NSM Reporting Issue

Yesterday, I logged in to our SonicWall NSM and noticed that reports did not have data for a few days. I get an error when I generate the report in Reports / Rules. I go to Firewall / Inventory and go to our NSA 2700, and noticed that when you go to Monitor/ Overview / Live Monitor, there is no data.

Below are the steps I took to resolve the issue.

  • In Firewall View, Go to Device / AppFlow / Flow Reporting to check your settings. Checked Statistics, and made sure your connection flows and data flows. Check your Settings that it is still set to send the report.
  • Go to Device / Settings / Licenses and just check that your license did not expire.
  • Go to Device / Settings / Firmware and Settings and check the firmware version. This will be a good time to check if your cloud backup is working and download a local backup.

At the time, all looks good, except that the firmware is one release behind. I called support just to confirm that there is no current issue with NSM, and it was confirmed that there is no ongoing service issue. Support checked settings and suggested to update to the latest firmware.

  • I logged in to MySonicWall and downloaded the latest release. I logged in to our NSA 2700 locally and installed the firmware. The update took about 20 to 25 minutes since we have HA setup. Firmware was installed on Secondary, failed over to Secondary then it was installed on Primary. After the Primary installation was completed, I failed over back to Primary.
  • I went back to NSM and clicked on Synchronize Firewall as it is showing up as unmanaged.
  • I then clicked on Reconfigure Reporting & Analytics to make sure the reporting was synching.

The update process was smooth, and we experienced no significant disruptions during the transition to the latest firmware. 10 minutes, I revisited Firewall View / Monitor / Overview / Live Monitor on our SonicWall NSM, and I now see data/ information showing up.

Arduino and the SD Cards

As I delved deeper into my Arduino journey, I soon recognized the importance of collecting and storing data. This realization came after I had gained proficiency in working with various components, including piezo buzzers, vibrant LEDs, precise digital temperature and humidity sensors, real-time clocks (RTC), and the 16×2 LCD display. With these tools at my disposal, I was able to embark on a fascinating project – a clock that not only kept time but also displayed real-time humidity and temperature readings. This project marked a significant milestone in my Arduino learning adventure, showcasing the practical applications of my newfound skills.

Read more: Arduino and the SD Cards

List of Materials

  • Arduino Uno R3
  • Lexar 32GB Micro SD Card, microSDHC UHS-I Flash Memory Card

References

Notes

Arduino and the RTC (Real Time Clock)

After learning how to use a 16 x 2 LCD Display with Arduino to show data, I was inspired to create a digital clock using use a 16 x 2 LCD Display to display date and time. However, I discovered that Arduino lacks a built-in clock. To address this, I learned that an RTC (Real-Time Clock) is necessary to work with date and time information.

Read more: Arduino and the RTC (Real Time Clock)

On this project, I used a DS3231 Real Time Clock Module.

On the DS3231 Real Time Clock Module, I connected the red cable to VCC, then connected the black cable to the ground pin. I connected the orange cable to SCL pin, then connected the yellow cable to SDA pin.

This is how it looks how I connected the DS3231 Real Time Clock Module to Arduino Uno.

This is what the serial monitor will look like after the sketch is uploaded to the Arduino Uno.

Connect your Arduino to your computer and upload the sketch. Below is the sketch to upload to your Arduino.

#include <Wire.h>
#include <DS3231.h>

DS3231 Clock;
RTClib RTC;

void setup() {
  // put your setup code here, to run once:
  Wire.begin();
  Serial.begin(9600);

  Clock.setYear(23);
  Clock.setMonth(10);
  Clock.setDate(9);
  Clock.setDoW(1);
  Clock.setHour(0);
  Clock.setMinute(10);
  Clock.setSecond(50);
  Clock.setClockMode(0);
  }

void loop() {
  // put your main code here, to run repeatedly:
  DateTime Time = RTC.now();

  Serial.print(Time.year(), DEC);
  Serial.print("/");
  Serial.print(Time.month(), DEC);
  Serial.print("/");
  Serial.print(Time.day(), DEC);
  Serial.print(" ");
  Serial.print(Time.hour(), DEC);
  Serial.print(":");
  Serial.print(Time.minute(), DEC);
  Serial.print(":");
  Serial.print(Time.second(), DEC);
  Serial.println();

  delay(1000);
}

List of Materials

  • Arduino Uno R3
  • DS3231 AT24C32 Real Time Clock Module
  • Male-to-female breadboard jumper ribbon cables

References

Notes