Zenity IT Asset Request Tool – The Ultimate Linux Automation (2025)

Automating IT Asset Requests Using Bash, Zenity, and Python

I built this tool to Zenity make it easier for people to request IT gear without sending emails back and forth. It pops up a little interface, lets you pick what you need, fill in your info, and it handles the rest — including notifying the IT team. No login, no web app.

What This Tool Does

This is a simple, GUI-based IT asset request tool. It’s built using:

  • Bash (shell scripting) to run the logic
  • Zenity to display clean little popup windows and forms
  • Python 3 to send confirmation emails automatically

The idea is simple:

  • Show a list of available IT items (from a file)
  • Let the user select what they want
  • Collect their info (name, ID, email, etc.)
  • Send the request to the IT team and a copy to the user

No web server, No database – just fast, functional, and easy to run on any Linux desktop.

ALSO READ:

Prerequisites :

Before running this tool, make sure the following are installed on your system:

OS Requirements

  • Linux desktop environment (Zenity is GUI-based; not for headless servers)

Required Packages

  • Bash (default on most Linux distros)
  • Zenity – for GUI popups
sudo apt install zenity     # Debian/Ubuntu  
sudo dnf install zenity     # Fedora/RHEL  

Python 3 – for sending emails

Gmail SMTP Setup (for Email Notifications)

  • Enable 2-Step Verification on your Gmail account.
  • Generate a Gmail App Password (not your normal password).

Click here to go GitHub repos link

Project

Sample Asset Inventory

201 Monitor - Apple Studio Display 27" - Available
202 Laptop - MacBook Pro M3 Max 16" - Not Available
203 Mouse - Logitech MX Master 3S Wireless - Available
204 Keyboard - Keychron K8 Wireless Mechanical - Available
205 Software - Adobe Creative Cloud Suite - Not Available
206 Mobile - iPhone 15 Pro Max - Available
207 Headset - Bose QuietComfort Ultra - Available
208 Tablet - iPad Pro 12.9" with Pencil - Not Available
209 Docking Station - CalDigit TS4 Thunderbolt 4 - Available
210 Webcam - Elgato Facecam Pro 4K - Available

Main Script

#!/bin/bash

INVENTORY="inventory.txt"
LOG="requests_log.txt"
EMAIL_SCRIPT="send_email.py"

if [ ! -f "$INVENTORY" ]; then
    zenity --error --text="❌ inventory.txt not found!" --width=300
    exit 1
fi

# Build Zenity checklist safely
options=()
while IFS= read -r line; do
    code=$(echo "$line" | awk '{print $1}')
    name=$(echo "$line" | cut -d '-' -f2- | rev | cut -d '-' -f2- | rev | sed 's/^ *//;s/ *$//')
    status=$(echo "$line" | awk -F '-' '{print $NF}' | sed 's/^ *//;s/ *$//')

    if [[ "$status" == "Available" ]]; then
        options+=("FALSE" "$code" "$name" "$status")
    else
        options+=("FALSE" "$code" "$name (Unavailable)" "$status")
    fi
done < "$INVENTORY"

selected_codes=$(zenity --list --checklist \
    --title="🖥 Select IT Assets to Request" \
    --column="Select" --column="Code" --column="Asset" --column="Status" \
    "${options[@]}" \
    --width=800 --height=400)

if [ -z "$selected_codes" ]; then
    zenity --warning --text="No assets selected." --width=300
    exit 1
fi

# Collect user details
emp_name=$(zenity --entry --title="Employee Name" --text="Enter your full name:")
emp_id=$(zenity --entry --title="Employee ID" --text="Enter your employee ID:")
email=$(zenity --entry --title="Email" --text="Enter your email address:")

if [[ -z "$emp_name" || -z "$emp_id" || -z "$email" ]]; then
    zenity --error --text="All fields are required!" --width=300
    exit 1
fi

# Multiline comment box
comment=$(zenity --text-info \
  --editable \
  --title="Justification / Comment" \
  --width=500 --height=300 \
  --filename=/dev/null)
comment=${comment:-"N/A"}

# Ask for priority using a combo box
priority=$(zenity --forms \
    --title="Select Priority Level" \
    --add-combo="Priority" \
    --combo-values="High|Medium|Low")

if [ -z "$priority" ]; then
    zenity --error --text="You must select a priority level!" --width=300
    exit 1
fi

# Validate selected assets
requested_assets=""
unavailable_assets=""
IFS="|" read -ra codes <<< "$selected_codes"
for code in "${codes[@]}"; do
    line=$(grep "^$code " "$INVENTORY")
    if [ -n "$line" ]; then
        name=$(echo "$line" | cut -d '-' -f2- | rev | cut -d '-' -f2- | rev | sed 's/^ *//;s/ *$//')
        status=$(echo "$line" | awk -F '-' '{print $NF}' | sed 's/^ *//;s/ *$//')
        if [[ "$status" == "Available" ]]; then
            requested_assets+="$name\n"
        else
            unavailable_assets+="$name\n"
        fi
    fi
done

if [ -n "$unavailable_assets" ]; then
    zenity --error --title="Unavailable Items Selected" \
    --text="You selected unavailable items:\n\n$unavailable_assets\n\nPlease deselect them and try again." --width=400
    exit 1
fi

# Save log
request_id=$(date +%s)
timestamp=$(date "+%Y-%m-%d %H:%M:%S")

echo "$timestamp | Request ID: $request_id | $emp_id | $emp_name | Priority: $priority | Comment: $comment | $requested_assets" >> "$LOG"

# Send email
python3 "$EMAIL_SCRIPT" "$emp_name" "$emp_id" "$email" "$requested_assets" "$request_id" "$priority" "$comment"

if [ $? -eq 0 ]; then
    zenity --info --title="Request Submitted" --text="Your IT asset request has been submitted and emailed." --width=350
else
    zenity --error --title="Email Failed" --text="There was a problem sending the confirmation email." --width=350
fi


Email Notification Script Python

import smtplib
import sys
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart

if len(sys.argv) < 8:
    print("Usage: send_email.py <name> <emp_id> <email> <assets> <request_id> <priority> <comment>")
    sys.exit(1)

name = sys.argv[1]
emp_id = sys.argv[2]
recipient_email = sys.argv[3]
requested_assets = sys.argv[4].replace("\\n", "\n")
request_id = sys.argv[5]
priority = sys.argv[6]
comment = sys.argv[7]

# Email config (customize)
sender_email = "krishnatummeti@gmail.com"
sender_password = "sqslafjkxxxxxxx"
it_email = "krishnatummeti@gmail.com"  # IT department email

# Email to employee
subject_user = f"IT Asset Request Confirmation (ID: {request_id})"
body_user = f"""
Hello {name},

Your IT asset request has been received successfully.

🔹 Request ID: {request_id}
🔹 Employee ID: {emp_id}
🔹 Priority: {priority}
🔸 Comment: {comment}

📦 Requested Assets:
{requested_assets}

You will be contacted shortly by the IT department.

Best regards,  
IT Support Team
"""

# Email to IT team
subject_it = f"[NEW REQUEST] {name} ({emp_id}) - Priority: {priority}"
body_it = f"""
New IT Asset Request Received:

🔹 Request ID: {request_id}
🔹 Employee Name: {name}
🔹 Employee ID: {emp_id}
🔹 Priority: {priority}
🔸 Comment: {comment}

📦 Requested Assets:
{requested_assets}

This is an automated notification.
"""

try:
    with smtplib.SMTP("smtp.gmail.com", 587) as server:
        server.starttls()
        server.login(sender_email, sender_password)

        # Email to employee
        msg_user = MIMEMultipart()
        msg_user["From"] = sender_email
        msg_user["To"] = recipient_email
        msg_user["Subject"] = subject_user
        msg_user.attach(MIMEText(body_user, "plain"))
        server.send_message(msg_user)

        # Email to IT
        msg_it = MIMEMultipart()
        msg_it["From"] = sender_email
        msg_it["To"] = it_email
        msg_it["Subject"] = subject_it
        msg_it.attach(MIMEText(body_it, "plain"))
        server.send_message(msg_it)

    print("Emails sent to employee and IT department.")
except Exception as e:
    print(f" Failed to send email: {e}")
    sys.exit(1)

Log File

Every request gets stored in a local log file in this format:

2025-07-26 23:30:01 | Request ID: 1753552801 | 123456 | krishna T | Lenovo ThinkPad\niPhone 13\nSony WH-1000XM5\n

How to Run the Tool

  1. Ensure prerequisites are installed (Zenity, Python 3).
  2. Edit inventory.txt with your current assets.
  3. Update email and password in send_email.py.
  4. Run the main script:
chmod +x asset_request_gui.sh
./asset_request_gui.sh

Example Output :

Zenity IT Asset Request Tool – The Ultimate Linux Automation (2025) -2
Zenity IT Asset Request Tool – The Ultimate Linux Automation (2025) -1

Thank you.

Leave a Comment

Index