Author: jetnmariano

  • Technical Notes Written When They Matter

    Technical Notes Written When They Matter

    This is a collection of technical notes written when they matter.

    Some posts come from the server room, others from moments of reflection. They document real decisions, lessons learned, and quiet realizations from years in IT and life.

    There is no fixed schedule here. I write when there is something worth recording.

    βž” Check out my PowerShell Toolbox for essential automation scripts.

    Technical Notes Written When They Matter

    πŸ’»Feb 7, 2026 – Built in Motion, Seeing Afar Off

    πŸ’»Feb 2, 2026 – Subnetting Makes Sense When You Meet the ISP

    πŸ’»Jan 25, 2026 – The Problem Lives Below Windows

    πŸ’»Jan 16, 2026 – Windows 11 is Not the Problem

    πŸ’»Jan 9, 2026 – Sysmon on Windows

    πŸ’»Dec 31, 2025 – DHCP is Boring Until it is Not

    πŸ’»Dec 17, 2025 – High-Availability Engineering: Implementing Geo-Redundancy and Real-Time Heartbeats

    πŸ’»Dec 10, 2025 – How to Install Sysmon on Windows 11 (Step-by-Step Guide)

    πŸ’»Dec 3, 2025 – Advanced Exchange Online Security and Compliance.

    πŸ’» Nov 28, 2025 – My Essential IT Troubleshooting Guide

    πŸ’» Nov 26, 2025 – Terraform made simple

    πŸ’» Nov 25, 2025 CIS for M365 (Hardening & Best Practices)

    πŸ’» Nov 24, 2025 Email Retention in M365 (Best Practices)

    πŸ’» Nov 23, 2025 The Evolution of Microsoft Exchange: From 5.0 to Exchange Online (EXO)

    πŸ’» Nov 22, 2025 DMARC (Domain-based Message Authentication, Reporting & Conformance)

    πŸ’» Nov 21, 2025 Why PowerShell Still Beats Purview for Real Forensics

    πŸ’» Nov 20, 2025 Terraform for M365 & Azure

    πŸ’» Nov 18, 2025 Quick β€œReflexes” Using PowerShell to Block Bad Actors

    πŸ’» Nov 17, 2025 Litigation Hold in Microsoft 365

    πŸ’» Nov 15, 2025 DKIM Security: How Signing and Key Rotation Stop Email Spoofing

    πŸ’» Nov 12, 2025 Exchange Online Throttling Policies

    πŸ’» Nov 06, 2025 Why RFC Email Standards Are Not Enough

    πŸ’» Oct 31, 2025 Path to Become a Developer

    πŸ’» Oct 31, 2025 Path to Become an Infrastructure Engineer

    πŸ’» Oct 17, 2025 Email Spoofing Explained

    πŸ’» Oct 12, 2025 How BEC (Business Email Compromise) and EAC (Email Account Compromise)

    πŸ’» Oct 9, 2025 How I Protected VIP Mailboxes in Exchange

    πŸ’» Oct 06, 2025 A 10-Command Playbook to Stop Email Impersonation

    πŸ’» Oct 04, 2025 Pulling M365 Sign-in Locations via AzureADPreview

    πŸ’» Oct 01, 2025 Restoring Delivery Safely: SCL-1 + Tenant Allow/Block List

    πŸ’» Sep 29, 2025 Beat the 99% Wall: Upgrade Windows 10 β†’ 11 the Easy Offline Way (Do This Before Oct 5, 2025)

    πŸ’» Sep 24, 2025Email Offboarding: Forward for 14 Days β†’ Then Retire the Mailbox (No Shared Mailboxes)

    πŸ’» Sep 19, 2025Cloning a VM with PowerShell and VMware PowerCLI

    πŸ’» Sep 14, 2025Fixing a β€œSender not allowed” Everyone DL

    πŸ’» Sep 9, 2025Ops Note β€” Picking the best vSAN host with one PowerCLI check

    πŸ’» Sep 4, 2025Fixing β€œSender not allowed” to an internal group (Exchange Online) β€” a quick forensic + runbook

    πŸ’» Sep 1, 2025Outlook Won’t Send, Can’t Search, or Stuck on β€œUpdating”? A One-Page Fix (for Everyone)

    πŸ’» Aug 31, 2025 When a β€œMicrosoft” alert hijacks your screen after a spoofed Facebook call

    πŸ’» Aug 25, 2025 PC Suddenly Slow? Here’s a 60 seconds triage before calling IT

    πŸ’» Aug 21, 2025 – Secure Azure setup with Entra ID, Bastion, and private VM

    πŸ’» Aug 18, 2025 β€” Hot-cloning a Running Windows 11 VM in vSphere

    πŸ’» Aug 14, 2025 β€” The Cloud Above Us AWS, Azure, GCP

    πŸ’» Aug 10, 2025 Blog: Secure Automation with PowerShell SecretManagement: Simplifying Credential Management for IT Pros

    πŸ’» Aug 5, 2025 Blog:Migrating Azure AD Scripts to Microsoft Graph PowerShell: A Practical Guide for IT Administrators

    πŸ’» July 29, 2025 Blog:Fixing Disabled Azure AD Accounts: PowerShell vs Portal

    πŸ’» July 25, 2025 Blog:How to Bypass Spam Filtering for Internal Senders Using PowerShell

    πŸ’» July 20, 2025 Blog:Because I Have Been Given Much, I Too Must Give

    πŸ’» July 16, 2025 Blog:Ransomware: What It Is and How I Survived Multiple Attacks

    πŸ’» July 12, 2025 Blog:From IIS Logs to Iron Discipline: How My Son and I Share the Same Grit in Fitness and IT

    πŸ’» July 8, 2025 Blog: Where I Leave the Past, and Meet Myself Again

    πŸ’» July 4, 2025 Blog:I Am Grateful to Be in the Land of the Free and Home of the Brave

    πŸ’» June 27, 2025 Blog:When the Strong Get Tired: Finding Strength in the Silence

    πŸ’» June 22, 2025 Blog:Please Wait: When the Helper Needs Help

    πŸ’» June 15, 2025 Blog:A Father’s Day Flashback – Pancakes, Peter Pan, and a Heart Full of Memories

    πŸ’» June 8, 2025 Blog:Why I Still Use PowerShell Every Week

    πŸ’» June 1, 2025 Blog: The Ultimate IT Troubleshooting Framework

    πŸ’» May 25, 2025 Blog: 5 Essential Cloud Solutions for IT Admins

    πŸ’» May 18, 2025, 2025 Blog:Strength Is Survival

    πŸ’» May 10, 2025, 2025 Blog:How I Deployed and Cleaned Up a Windows Server VM in Azure with PowerShell

    πŸ’» May 2, 2025, 2025 Blog:The Price of Gaining Respect in the IT World
    πŸ’» April 26, 2025 Blog: What Is SIEM? Why it matters, what it solves, and how to implement it effectively.

    Β© 2012–2026 Jet Mariano. All rights reserved.
    For usage terms, please see the Legal Disclaimer.

  • Track Domain-Joined Devices by Join Date Using PowerShell

    When you’re managing hundreds of devices in an Active Directory environment, tracking when a machine joins the domain can help in everything from license compliance to forensic investigations.

    Recently, I needed to identify a laptop that joined our domain on a specific date to verify a SolidWorks license assignment β€” and these two PowerShell commands did the job flawlessly.


    πŸ”Ή 1. Get the Most Recently Joined Computer

    Use this command to find the latest computer object added to Active Directory:

    powershellCopyEditImport-Module ActiveDirectory
    
    Get-ADComputer -Filter * -Property whenCreated |
    Sort-Object whenCreated -Descending |
    Select-Object Name, whenCreated -First 1
    

    Why this matters:
    This is especially useful when onboarding new machines or auditing join activity after reimaging.


    πŸ”Ή 2. Find Devices Joined on a Specific Date

    To find any computer joined on a specific day β€” for example, April 25, 2025 β€” use:

    powershellCopyEdit$startDate = Get-Date "04/25/2025 00:00:00"
    $endDate = Get-Date "04/26/2025 00:00:00"
    
    Get-ADComputer -Filter * -Property whenCreated |
    Where-Object { $_.whenCreated -ge $startDate -and $_.whenCreated -lt $endDate } |
    Select-Object Name, whenCreated |
    Sort-Object whenCreated
    

    Why this helps:
    Perfect for license verification, asset tracking, or validating compliance windows. You can adapt the date range to capture entire weeks, weekends, or even off-hours join attempts.


    πŸ” Final Thought

    Even a simple attribute like whenCreated becomes a powerful audit tool when combined with the right script. These commands now live in my PowerShell toolbox β€” and they just helped solve a license tracking challenge without any guesswork.


    βœ… Add these to your script collection.
    βœ… Automate the insight.
    βœ… Stay ahead of the curve.

  • PHP + SQL Demo: Simple Form with Database Insert

    Welcome to Projects
    This demo showcases a simple PHP + SQL form that inserts user data into a database. Whether you’re just starting out in development or refreshing your backend skills, this lab will help you understand the fundamentals of handling form data securely and efficiently.

    Let’s dive into the code and see how the magic happens!

    <!-- index.php -->
    <form method="post" action="insert.php">
      <label for="name">Name:</label><br>
      <input type="text" id="name" name="name" required><br><br>
      
      <label for="email">Email:</label><br>
      <input type="email" id="email" name="email" required><br><br>
      
      <input type="submit" value="Submit">
    </form>
    
    <!-- insert.php -->
    <?php
    $servername = "localhost";
    $username = "root"; // change as needed
    $password = ""; // change as needed
    $dbname = "demo_db"; // make sure this DB exists

    // Create connection
    $conn = new mysqli($servername, $username, $password, $dbname);

    // Check connection
    if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
    }

    // Sanitize inputs
    $name = htmlspecialchars($_POST['name']);
    $email = htmlspecialchars($_POST['email']);

    // Prepare and bind
    $stmt = $conn->prepare("INSERT INTO users (name, email) VALUES (?, ?)");
    $stmt->bind_param("ss", $name, $email);

    if ($stmt->execute()) {
    echo "New record created successfully.";
    } else {
    echo "Error: " . $stmt->error;
    }

    $stmt->close();
    $conn->close();
    ?>


    Stay tunedβ€”next time we’ll connect this form to a hosted SQL database and sanitize inputs using prepared statements. This is just the beginning of your full-stack journey!

    Β© 2012–2025 Jet Mariano. All rights reserved.
    For usage terms, please see the Legal Disclaimer.

  • PowerCLI: Cloning and Deleting VMs

    In addition to monitoring, managing VMs is a key task for administrators. Below are simple PowerCLI commands for cloning and deleting VMs.

    Cloning a VM

    $sourceVM = Get-VM -Name "template-vm"
    $targetHost = Get-VMHost -Name "esxi-host-01"
    $datastore = Get-Datastore -VMHost $targetHost | Where-Object {$_.Name -like "vsanDatastore"}
    
    New-VM -Name "cloned-vm" `
           -VM $sourceVM `
           -VMHost $targetHost `
           -Datastore $datastore `
           -ResourcePool ($targetHost | Get-ResourcePool)

    Deleting a VM

    Get-VM -Name "cloned-vm" | Remove-VM -DeletePermanently -Confirm:$false

    These commands are especially useful for lab environments or when automating template-based VM provisioning.


    Conclusion Use this PowerShell command as part of your regular cluster health checks. When combined with vCenter’s vSAN resync and health dashboards, it gives you the full picture to maintain optimal performance and avoid storage imbalances.

    Stay tuned for a follow-up post on triggering manual rebalancing using RVC (Ruby vSphere Console).

    Β© 2012–2025 Jet Mariano. All rights reserved.
    For usage terms, please see the Legal Disclaimer.

  • Monitoring vSAN Host Resource Usage with PowerShell

    Introduction: Keeping your vSAN environment healthy and balanced is critical to maintaining performance and avoiding bottlenecks. One of the best ways to stay ahead of potential issues is by proactively monitoring your ESXi host’s CPU and memory usage using PowerShell and PowerCLI. In this post, we’ll walk through a script that provides a quick overview of resource usage across your vSAN cluster β€” a valuable step before deciding whether to initiate a manual rebalance.


    PowerShell Script to Monitor vSAN Host Resource Usage

    Get-VMHost | Select Name, `
        @{N="CPU Usage MHz"; E={($_.CpuUsageMhz)}}, `
        @{N="Total CPU MHz"; E={($_.CpuTotalMhz)}}, `
        @{N="Memory Usage GB"; E={[math]::Round($_.MemoryUsageGB, 2)}}, `
        @{N="Total Memory GB"; E={[math]::Round($_.MemoryTotalGB, 2)}}

    Sample Output

    Host NameCPU Usage MHzTotal CPU MHzMemory Usage GBTotal Memory GB
    esxi-host-016,405115,168151.94511.71
    esxi-host-027,148115,168199.02511.71
    esxi-host-032,089115,168124.49511.71

    What This Tells You

    • CPU Load: In the sample output, CPU usage is consistently low (<10%), meaning the compute load is healthy.
    • Memory Load: Memory usage ranges from ~24% to ~39%, suggesting room for optimization or upcoming load balancing.

    When to Rebalance

    If you see disproportionate usage β€” for example, one host consistently nearing 80%+ memory while others are underutilized β€” it may be time to initiate a vSAN rebalance.

    This script gives you the confidence to proceed with rebalance safely during production hours, especially when CPU usage is low and no resync activities are ongoing.


    Conclusion Use this PowerShell command as part of your regular cluster health checks. When combined with vCenter’s vSAN resync and health dashboards, it gives you the full picture to maintain optimal performance and avoid storage imbalances.

    Stay tuned for a follow-up post on triggering manual rebalancing using RVC (Ruby vSphere Console).

    Β© 2012–2025 Jet Mariano. All rights reserved.
    For usage terms, please see the Legal Disclaimer.

  • The Importance of SIEM, APM, and Privileged Access Management in Modern IT Security

    Introduction

    In today’s digital landscape, cybersecurity is more than just antivirus software and firewallsβ€”it’s about layered security across endpoints, networks, identities, and applications. With cyber threats evolving daily, businesses must adopt proactive monitoring and defense mechanisms. This is where Security Information and Event Management (SIEM), Application Performance Monitoring (APM), and Privileged Access Management (PAM) come into play.

    This guide will cover the importance of these tools, best practices, and how to integrate them with enterprise-grade security solutions like Cisco MX, Cisco Umbrella, CyberArk, and DUO.


    1. Security Information and Event Management (SIEM)

    SIEM solutions aggregate, analyze, and correlate security data from multiple sources, providing real-time visibility into potential threats.

    Why SIEM Matters:

    • Centralized Log Management: Collects logs from firewalls, servers, endpoints, and applications.
    • Threat Detection: Uses AI and correlation rules to identify anomalies.
    • Incident Response: Sends alerts when suspicious activity is detected.
    • Compliance: Helps meet PCI-DSS, HIPAA, SOX, and Hi-Trust requirements.

    Recommended SIEM Solutions:

    βœ… Splunk – Enterprise-level security analytics.
    βœ… Microsoft Sentinel – Cloud-native SIEM for Microsoft ecosystems.
    βœ… DataDog – Lightweight SIEM with cloud integrations.
    βœ… Elastic SIEM – Open-source alternative.


    2. Application Performance Monitoring (APM)

    APM tools monitor application behavior, uptime, and response times to ensure optimal performance and detect security anomalies.

    Why APM Matters:

    • Proactive Threat Identification: Detects application-layer attacks.
    • Performance Optimization: Reduces downtime and enhances user experience.
    • Integration with SIEM: Provides deeper insights into suspicious activity.

    Recommended APM Tools:

    βœ… Datadog APM – Cloud monitoring with SIEM integration.
    βœ… Dynatrace – AI-powered full-stack monitoring.
    βœ… AppDynamics – Deep visibility into application health.
    βœ… SolarWinds APM – Cost-effective solution for IT teams.


    3. Privileged Access Management (PAM) & Multi-Factor Authentication (MFA)

    Privileged accounts are the biggest attack targets. Implementing PAM with MFA ensures that admin accounts are secure.

    Why PAM & MFA Matter:

    • Least Privilege Enforcement: Restricts admin access to critical systems.
    • Prevents Credential Theft: Limits exposure to compromised passwords.
    • Logs & Audits: Tracks administrative actions for compliance.

    Best Practices:

    βœ… Use CyberArk for managing privileged accounts.
    βœ… Require MFA (DUO, Microsoft Authenticator, YubiKey).
    βœ… Separate Personal & Admin Accounts:

    • Personal Account β†’ No admin rights.
    • Admin Account β†’ Requires 15-min auto MFA renewal (best practice in enterprises like PIMCO & CNB).

    4. Endpoint Protection with XDR

    Extended Detection & Response (XDR) provides real-time protection across endpoints, emails, and cloud workloads.

    Why XDR Matters:

    • AI-powered Threat Detection: Blocks malware, ransomware, and phishing attempts.
    • Zero Trust Security: Ensures only verified endpoints can access corporate networks.
    • SIEM Integration: Sends endpoint logs for analysis.

    Recommended XDR Solutions:

    βœ… Microsoft Defender XDR – Built-in for Microsoft environments.
    βœ… CrowdStrike Falcon – AI-driven endpoint security.
    βœ… SentinelOne XDR – Autonomous threat response.


    5. Network Perimeter Security: Cisco MX & Cisco Umbrella

    Firewalls alone are not enough. Organizations need cloud-based DNS security & perimeter defense.

    Why Cisco MX & Umbrella Matter:

    • Protects Against DNS-layer Attacks (e.g., phishing & malware sites).
    • Prevents Data Exfiltration (blocks malicious domains before connections happen).
    • Works with SIEM & XDR (for full security visibility).

    Best Practices:

    βœ… Deploy Cisco MX for firewall + SD-WAN security.
    βœ… Use Cisco Umbrella to block malicious internet traffic.
    βœ… Segment Networks to isolate critical resources.


    Conclusion: Security Requires Layered Defense

    Cybersecurity isn’t just about one toolβ€”it’s about a layered approach:

    1. SIEM for centralized monitoring.
    2. APM for app performance & security insights.
    3. PAM & MFA for privileged access control.
    4. XDR for endpoint protection.
    5. Cisco MX & Umbrella for perimeter security.

    Implementing these tools reduces risk, improves compliance, and protects IT infrastructure from modern threats.


    Next Steps:

    βœ… Read our Step-by-Step Guides for each tool (coming soon).
    βœ… Explore PowerShell automation for security hardening.
    βœ… Contact us for enterprise security consulting (if applicable).

    πŸ”— Stay tuned for more guides on securing your IT infrastructure!


    Β© 2012–2025 Jet Mariano. All rights reserved.
    For usage terms, please see the Legal Disclaimer.

  • The Importance of SIEM and Best Practices in Enterprise Security

    Introduction

    In today’s cybersecurity landscape, Security Information and Event Management (SIEM) plays a crucial role in protecting organizations from threats. A robust SIEM system centralizes security monitoring, aggregates logs, detects anomalies, and helps security teams respond to incidents in real time. However, SIEM is only one piece of a comprehensive security framework. To maximize its effectiveness, it should be integrated with other advanced security solutions such as APM tools, privileged access management (CyberArk), multi-factor authentication (Duo), and endpoint detection and response (XDR).

    The Role of SIEM in Security

    A SIEM system provides the following key functions:

    • Centralized Log Management: Aggregates and normalizes logs from different sources.
    • Real-Time Threat Detection: Uses correlation rules and AI-driven analytics to detect anomalies.
    • Incident Response: Helps security teams investigate alerts and mitigate threats.
    • Compliance & Auditing: Meets regulatory requirements for PCI-DSS, HIPAA, SOX, and Hi-Trust.

    Recommended SIEM Solutions:

    1. Splunk – Market leader in log analysis and threat detection.
    2. IBM QRadar – Integrates well with enterprise IT infrastructure.
    3. Microsoft Sentinel – Cloud-based SIEM with strong integration into Microsoft’s security ecosystem.
    4. LogRhythm – Offers automation and advanced analytics.

    Integrating APM Tools for Security & Performance Monitoring

    APM (Application Performance Monitoring) tools work alongside SIEM to ensure application security and performance. APM tools help in:

    • Detecting performance bottlenecks before they become security vulnerabilities.
    • Correlating security events with application behavior.
    • Enhancing log visibility for forensic analysis.

    Recommended APM Tools:

    1. Datadog – Offers monitoring for applications, logs, and security events.
    2. Dynatrace – AI-powered analytics for anomaly detection.
    3. New Relic – Provides application telemetry and distributed tracing.
    4. AppDynamics – Deep visibility into application performance.
    5. SolarWinds – A cost-effective alternative with performance monitoring capabilities.

    The Importance of CyberArk for Privileged Access Management

    Why Privileged Access Management (PAM) Matters? Privileged accounts are the highest-value targets for cybercriminals. CyberArk provides:

    • Credential Vaulting – Securely stores and rotates privileged credentials.
    • Session Isolation – Prevents direct access to critical systems.
    • Least Privilege Enforcement – Ensures users only have access to what they need.
    • Audit Logging – Records privileged activity for compliance.

    Best Practices: Personal vs. Admin Accounts with Duo MFA

    Many enterprises make the mistake of using a single account for both personal and administrative tasks, increasing security risks. Best practices recommend:

    • Personal Account for Day-to-Day Use:
      • No elevated privileges.
      • Limited access to sensitive data.
      • MFA enforced for login.
    • Admin Account for Privileged Tasks:
      • Protected by Duo MFA with time-based authentication every 15 minutes.
      • Password resets automatically every 15 minutes (e.g., CyberArk enforcement).
      • No direct internet access (restricted browsing and email access).

    Endpoint Protection with XDR

    Endpoints are the most vulnerable attack surface. Extended Detection and Response (XDR) solutions provide:

    • Advanced Threat Detection: AI-driven monitoring for malware, ransomware, and behavioral anomalies.
    • Automated Response: Blocks and isolates compromised endpoints.
    • Integration with SIEM & SOAR: Security teams can automate investigations and threat responses.

    Recommended XDR Solutions:

    1. Microsoft Defender XDR – Natively integrates with Microsoft’s security suite.
    2. CrowdStrike Falcon XDR – Lightweight agent with cloud-native capabilities.
    3. SentinelOne – AI-driven threat hunting.
    4. Palo Alto Cortex XDR – Strong perimeter and endpoint defense.

    Perimeter Security: Cisco MX & Cisco Umbrella

    Perimeter Security & Zero Trust Architecture A properly configured perimeter ensures that malicious traffic is blocked before it reaches endpoints or internal servers.

    • Cisco Meraki MX – Next-generation firewall with content filtering, VPN, and IPS/IDS.
    • Cisco Umbrella – Cloud-delivered security that blocks malicious domains and phishing attempts at the DNS level.

    Conclusion

    An effective security framework requires a layered defense strategy that integrates SIEM, APM, PAM, MFA, XDR, and Perimeter Security.

    By implementing these solutions, organizations ensure: βœ” Proactive threat detection and response βœ” Regulatory compliance (PCI-DSS, HIPAA, SOX, Hi-Trust) βœ” Minimized attack surface βœ” Reduced impact of security breaches

    Cybersecurity is not just about having toolsβ€”it’s about implementing the right tools, enforcing best practices, and continuously monitoring for evolving threats. The Force is always within you, but having the right technology stack ensures that you are always prepared for battle.

    Β© 2012–2025 Jet Mariano. All rights reserved.
    For usage terms, please see the Legal Disclaimer.

  • PowerShell Script: Managing Shared Mailbox Access

    Overview

    This guide provides PowerShell commands to remove user access from shared mailboxes and verify access removal in Microsoft Exchange Online.

    Prerequisites

    • Administrator privileges in Exchange Online.
    • PowerShell module for Exchange Online installed.
    • Proper authentication to Exchange Online.

    Step 1: Connect to Exchange Online

    Connect-ExchangeOnline -UserPrincipalName [email protected]

    Step 2: Remove User Access from Shared Mailboxes

    $User = "[email protected]"
    $SharedMailboxes = @("[email protected]", "[email protected]")
    
    foreach ($Mailbox in $SharedMailboxes) {
        Remove-MailboxPermission -Identity $Mailbox -User $User -AccessRights FullAccess -Confirm:$false
        Remove-RecipientPermission -Identity $Mailbox -Trustee $User -AccessRights SendAs -Confirm:$false
    }

    Step 3: Verify Access Removal

    foreach ($Mailbox in $SharedMailboxes) {
        Get-MailboxPermission -Identity $Mailbox | Where-Object { $_.User -like "$User" }
        Get-RecipientPermission -Identity $Mailbox | Where-Object { $_.Trustee -like "$User" }
    }

    If no results are returned, the user no longer has access.

    Step 4: Disconnect from Exchange Online

    Disconnect-ExchangeOnline -Confirm:$false

    Notes

    Additional Considerations

    • If users report still having access, check cached credentials or ensure changes have propagated.
    • If access needs to be reinstated, use Add-MailboxPermission and Add-RecipientPermission commands.

    This script helps maintain security and manage mailbox access efficiently within Exchange Online.

    Β© 2012–2025 Jet Mariano. All rights reserved.
    For usage terms, please see the Legal Disclaimer.

  • Automating User Offboarding in Microsoft 365 using PowerShell

    When a team member leaves your organization, it’s critical to offboard them securely and efficiently. Here’s a step-by-step PowerShell-based offboarding process that covers:

    βœ… Disabling the user in Local Active Directory
    βœ… Disabling the Azure AD account
    βœ… Removing all licenses
    βœ… Disabling MFA
    βœ… Converting the mailbox to a shared mailbox
    βœ… Granting full mailbox access to the supervisor


    Step 1 – Disable the User in Local Active Directory

    powershellCopyEditDisable-ADAccount -Identity jdoe
    

    Step 2 – Disable Azure AD User Account

    powershellCopyEditConnect-AzAccount
    Set-AzureADUser -ObjectId [email protected] -AccountEnabled $false
    

    Step 3 – Remove Microsoft 365 Licenses

    powershellCopyEditConnect-MgGraph -Scopes "User.ReadWrite.All", "Directory.ReadWrite.All"
    $UserId = (Get-MgUser -UserId [email protected]).Id
    Set-MgUserLicense -UserId $UserId -AddLicenses @() -RemoveLicenses @("tenant:licenseGUID")
    

    πŸ“ Replace tenant:licenseGUID with the appropriate license GUID assigned to your tenant.


    Step 4 – Disable MFA

    powershellCopyEditConnect-MsolService
    Set-MsolUser -UserPrincipalName [email protected] -StrongAuthenticationRequirements @()
    

    Step 5 – Convert Mailbox to Shared

    powershellCopyEditConnect-ExchangeOnline
    Set-Mailbox -Identity [email protected] -Type Shared
    

    Step 6 – Grant Supervisor Full Access to the Shared Mailbox

    powershellCopyEditAdd-MailboxPermission -Identity [email protected] -User [email protected] -AccessRights FullAccess -InheritanceType All
    

    Summary

    Using PowerShell for offboarding saves time and ensures consistency. Always document changes and communicate them to HR or management for final closure.

    Β© 2012–2025 Jet Mariano. All rights reserved.
    For usage terms, please see the Legal Disclaimer.

  • 10 Essential PowerShell Commands for IT Administrators

    πŸ’» PowerShell is an IT Admin’s best friendβ€”whether you’re managing Active Directory, troubleshooting network issues, or automating daily tasks. These essential commands will help you work smarter, not harder.


    πŸ”Ή 1. Find All Locked-Out Users in Active Directory

    πŸ›‘ Identify locked-out accounts instantly.

    powershellCopyEditSearch-ADAccount -LockedOut | Select-Object Name, SamAccountName, LockedOut
    

    βœ… Use Case: Quickly locate and assist locked-out users.


    πŸ”Ή 2. Unlock a User’s Account in Active Directory

    πŸ”“ Unlock a user’s account without using the GUI.

    powershellCopyEditUnlock-ADAccount -Identity jdoe
    

    βœ… Use Case: Enables IT admins to resolve lockouts in seconds.


    πŸ”Ή 3. Force a Password Reset for a User

    πŸ”„ Require a user to change their password at next login.

    powershellCopyEditSet-ADUser -Identity jdoe -PasswordNeverExpires $false -ChangePasswordAtLogon $true
    

    βœ… Use Case: Ensures security compliance without manual resets.


    πŸ”Ή 4. Retrieve System Boot Time

    πŸ–₯️ Check how long a system has been running.

    powershellCopyEdit(Get-Date) - (gcim Win32_OperatingSystem).LastBootUpTime
    

    βœ… Use Case: Displays uptime in days, hours, and minutes.


    πŸ”Ή 5. List Running Services with “Stopped” Status

    πŸš€ Check which services aren’t running.

    powershellCopyEditGet-Service | Where-Object { $_.Status -eq 'Stopped' } | Select-Object Name, DisplayName
    

    βœ… Use Case: Helps identify critical services that need restarting.


    πŸ”Ή 6. Test Internet Connectivity

    🌐 Check if a machine has an active internet connection.

    powershellCopyEditTest-NetConnection -ComputerName google.com -InformationLevel Detailed
    

    βœ… Use Case: Quick and easy network diagnostics.


    πŸ”Ή 7. Find the Last 10 Failed Login Attempts

    🚫 Track failed login attempts for security auditing.

    powershellCopyEditGet-EventLog -LogName Security -InstanceId 4625 -Newest 10
    

    βœ… Use Case: Detects brute-force attacks and failed password attempts.


    πŸ”Ή 8. Get a List of Users with Expired Passwords

    πŸ”‘ Find all users with expired passwords in Active Directory.

    powershellCopyEditSearch-ADAccount -PasswordExpired | Select-Object Name, SamAccountName
    

    βœ… Use Case: Prevents user lockouts and ensures password updates.


    πŸ”Ή 9. Get Disk Space Usage on a Server

    πŸ’Ύ Check available disk space across all drives.

    powershellCopyEditGet-PSDrive | Where-Object {$_.Provider -like "Microsoft.PowerShell.Core\FileSystem"} | 
    Select-Object Name, Used, Free
    

    βœ… Use Case: Helps avoid storage-related downtime before it happens.


    πŸ”Ή 10. List & Stop Running Processes

    ⚑ View active processes and terminate any misbehaving ones.

    powershellCopyEditGet-Process | Select-Object ProcessName, Id, CPU | Format-Table -AutoSize
    Stop-Process -Name "notepad" -Force
    

    βœ… Use Case: Quickly terminate resource-hogging processes without Task Manager.


    πŸš€ Conclusion: Work Smarter, Automate More!

    πŸ’‘ PowerShell is a game-changer for IT admins, allowing faster troubleshooting, better automation, and enhanced security monitoring. Whether you’re managing user accounts, securing systems, or optimizing network performance, these commands will save time and effort.

    πŸ–₯️ Next Steps?
    πŸ“Œ Bookmark this page and check back for more advanced PowerShell scripts!
    πŸ”— Need more automation tips? Visit the PowerShell Hub for deeper insights.

    Β© 2012–2025 Jet Mariano. All rights reserved.
    For usage terms, please see the Legal Disclaimer.

  • 10 Must-Have PowerShell Scripts for IT Troubleshooting

    PowerShell is a powerful tool for IT professionals, allowing automation, troubleshooting, and system management.
    Whether you’re handling system cleanup, retrieving Wi-Fi passwords, or managing processes, these PowerShell commands can be lifesavers.
    Here are five must-know PowerShell scripts to add to your IT arsenal.


    1. Extract All Installed Applications (For Inventory & Troubleshooting)

    Need to check what software is installed on a system? This script pulls a list of all installed applications along with their version, publisher, and installation date.

    Get-ItemProperty HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\* |
    Select-Object DisplayName, DisplayVersion, Publisher, InstallDate |
    Sort-Object DisplayName |
    Format-Table -AutoSize

    πŸ”Ή Bonus: Export the list to a CSV file for documentation:

    Get-ItemProperty HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\* |
    Select-Object DisplayName, DisplayVersion, Publisher, InstallDate |
    Export-Csv -Path "C:\InstalledApps.csv" -NoTypeInformation

    2. Find and Kill Stubborn Processes

    Have an unresponsive application? Use this script to forcefully close any running process by name.

    $processName = "Teams" # Change this to the process you want to kill
    Get-Process -Name $processName -ErrorAction SilentlyContinue | Stop-Process -Force

    πŸ”Ή Bonus: Convert it into a user-friendly GUI:

    Add-Type -TypeDefinition @"
    using System;
    using System.Windows.Forms;
    public class KillProcess {
        public static void Main() {
            string processName = Microsoft.VisualBasic.Interaction.InputBox("Enter process name to kill:", "Kill Process", "Teams");
            if (!string.IsNullOrEmpty(processName)) {
                System.Diagnostics.Process[] procs = System.Diagnostics.Process.GetProcessesByName(processName);
                foreach (var proc in procs) {
                    proc.Kill();
                }
            }
        }
    }
    "@ -Language CSharp
    
    [KillProcess]::Main()

    3. Automate System Cleanup (Cache, Temp Files, Event Logs)

    Over time, systems accumulate temporary files that can slow them down. This command clears temporary files, cache, and event logs:

    Write-Host "Clearing Temp Files, Cache, and Event Logs..." -ForegroundColor Green
    Remove-Item -Path "$env:TEMP\*" -Recurse -Force -ErrorAction SilentlyContinue
    Remove-Item -Path "C:\Windows\Temp\*" -Recurse -Force -ErrorAction SilentlyContinue
    Clear-EventLog -LogName Application, System, Security
    Write-Host "Cleanup Completed!" -ForegroundColor Cyan

    πŸ”Ή Bonus: Automate this cleanup by scheduling it in Task Scheduler.


    4. Retrieve Wi-Fi Passwords Saved on a PC

    Need to recover a saved Wi-Fi password? This script extracts the stored credentials for all previously connected networks:

    (netsh wlan show profile) | Select-String "\:(.+)$" | ForEach-Object { 
        $network = $_.Matches.Groups[1].Value.Trim()
        $password = (netsh wlan show profile name="$network" key=clear) | Select-String "Key Content\W+\:(.+)$"
        if ($password) { 
            Write-Host "Wi-Fi: $network | Password: $($password.Matches.Groups[1].Value.Trim())" -ForegroundColor Green 
        }
    }

    πŸ”Ή Use Case: If you’re connected to a Wi-Fi network but forgot the password, this script retrieves it instantly.


    5. Scan for Suspicious File Modifications (Forensic Command)

    This script performs a recursive scan on a target machine to find recently modified files with specific extensions and flag any that contain high-risk keywords. Ideal for forensic scenarios.

    $target = "RemoteComputerName"  # Replace with computer name or IP
    $extensions = @("*.ps1", "*.sql", "*.dll", "*.cs", "*.sln", "*.vbproj")
    $keywords = 'drop', 'truncate', 'remove', 'shutdown'
    
    $session = New-PSSession -ComputerName $target -ErrorAction SilentlyContinue
    if ($session) {
        Invoke-Command -Session $session -ScriptBlock {
            param($exts, $keywords)
            Get-ChildItem -Path "C:\" -Recurse -Include $exts -ErrorAction SilentlyContinue |
            Where-Object {
                $_.LastWriteTime -gt (Get-Date).AddDays(-90) -and
                ($_ | Select-String -Pattern ($keywords -join '|') -SimpleMatch -Quiet)
            } |
            Select-Object FullName, LastWriteTime, Length
        } -ArgumentList $extensions, $keywords | Export-Csv -Path "$env:USERPROFILE\Desktop\forensic-scan.csv" -NoTypeInformation
    
        Remove-PSSession $session
    } else {
        Write-Host "Unable to connect to $target"
    }
    

    Why it matters: This script was used during a forensic investigation while I was serving on a local government IT forensic team. Its purpose was to detect whether sensitive scripts or source code had been created, modified, or concealed on a colleague’s machine. By targeting specific file types and high-risk keywords (e.g., drop, truncate, remove, shutdown), the script helps identify signs of unauthorized automation, code tampering, or mismanagement of critical systems. It supported an internal review when key files were missing and operational stability was in question.


    6. Quick System Resource Snapshot

    # Display top 10 processes by CPU usage
    Get-Process | Sort CPU -Descending | Select -First 10
    
    # Show current CPU usage
    Get-Counter '\Processor(_Total)\% Processor Time'
    
    # Show available memory
    Get-Counter '\Memory\Available MBytes'
    
    # Summarize total, free, and used memory
    Get-WmiObject -Class Win32_OperatingSystem |
    Select-Object TotalVisibleMemorySize, FreePhysicalMemory |
    ForEach-Object {
        [PSCustomObject]@{
            'TotalMemoryMB' = [math]::Round($_.TotalVisibleMemorySize / 1024, 2)
            'FreeMemoryMB'  = [math]::Round($_.FreePhysicalMemory / 1024, 2)
            'UsedMemoryMB'  = [math]::Round(($_.TotalVisibleMemorySize - $_.FreePhysicalMemory) / 1024, 2)
        }
    }
    

    Why it matters: This comprehensive snapshot is a go-to tool for on-the-fly diagnostics. Whether you’re troubleshooting performance issues, memory leaks, or high CPU usage, this command instantly reveals which processes are draining resourcesβ€”without launching Task Manager or Performance Monitor. Ideal for quick triage during server slowdowns or SQL bottlenecks.

    7. Check System Uptime

    $uptime = (Get-Date) - (Get-CimInstance Win32_OperatingSystem).LastBootUpTime
    Write-Host "System Uptime: $($uptime.Days) Days, $($uptime.Hours) Hours, $($uptime.Minutes) Minutes" -ForegroundColor Cyan
    

    Why it matters: Quickly see how long the system has been runningβ€”helpful in determining recent reboots or crashes.

    8. Check Disk Space

    Get-PSDrive -PSProvider FileSystem | Select-Object Name, Used, Free, @{Name="Free(GB)";Expression={"{0:N2}" -f ($_.Free / 1GB)}}
    

    Why it matters: Instantly assess available drive space and avoid unexpected application or SQL failures due to low disk capacity.

    9. Review Event Logs (System Errors Only)

    Get-EventLog -LogName System -EntryType Error -Newest 20 | Format-Table TimeGenerated, Source, EventID, Message -AutoSize
    

    Why it matters: Check for hardware, driver, or system errors logged in the last eventsβ€”critical when troubleshooting.

    10. Forensic Script Scan – Local Machine Analysis

    This script performs a forensic scan of the local machine, identifying recently modified files with common scripting and development extensions. It’s ideal for monitoring changes or performing audits.

    $targetPath = "C:\"
    $extensions = '*.ps1', '*.php', '*.sql', '*.bat', '*.cmd', '*.vbs', '*.js', '*.dll', '*.config', '*.json'
    $outputPath = "C:\Temp\ScriptAuditReport.csv"
    
    Get-ChildItem -Path $targetPath -Include $extensions -Recurse -ErrorAction SilentlyContinue |
    Where-Object { $_.LastWriteTime -gt (Get-Date).AddDays(-90) } |
    Sort-Object LastWriteTime -Descending |
    Select-Object FullName, LastWriteTime |
    Export-Csv $outputPath -NoTypeInformation
    
    

    Why it matters: Use this script when you suspect undocumented code changes, malicious automation, or hidden activity on a machine. It pinpoints recently altered files with extensions commonly used for scripting or system manipulation. Ideal for incident response or auditing newly repurposed systems.

    Final Thoughts

    PowerShell is a must-have tool for IT professionals. These scripts help automate tasks, troubleshoot issues, and improve system efficiency. Which of these commands do you find most useful? Let me know in the comments!

    πŸš€ Stay tuned for more PowerShell tips and tricks!

    Β© 2012–2025 Jet Mariano. All rights reserved.
    For usage terms, please see the Legal Disclaimer.

  • How to Create and Manage a Shared Mailbox in Microsoft 365 Using PowerShell

    Introduction

    A shared mailbox allows multiple users to send and receive emails from a common address, making collaboration easier for teams. This guide walks you through creating a shared mailbox, assigning permissions, and verifying settings using PowerShell.

    Using PowerShell provides faster and more efficient management, especially when handling multiple mailboxes.


    πŸ”Ή Step 1: Connect to Microsoft 365 PowerShell

    Before creating the shared mailbox, connect to Exchange Online.

    Run the following command:

    powershellCopyEditConnect-ExchangeOnline -UserPrincipalName [email protected]
    

    πŸ“Œ Replace [email protected] with your admin account email.


    πŸ”Ή Step 2: Create the Shared Mailbox

    Use this PowerShell command to create a shared mailbox:

    powershellCopyEditNew-Mailbox -Shared -Name "TeamMailbox" -DisplayName "Team Shared Mailbox" -PrimarySmtpAddress "[email protected]"
    

    πŸ“Œ Replace "TeamMailbox" and "[email protected]" with your preferred mailbox name and email address.


    πŸ”Ή Step 3: Assign Permissions

    Once the mailbox is created, grant access to specific users.

    Grant Full Access (Allows users to manage the mailbox)

    powershellCopyEditAdd-MailboxPermission -Identity "[email protected]" -User "[email protected]" -AccessRights FullAccess -InheritanceType All
    

    Grant Send As Permission (Allows users to send emails from the shared mailbox)

    powershellCopyEditAdd-RecipientPermission -Identity "[email protected]" -Trustee "[email protected]" -AccessRights SendAs -Confirm:$false
    

    πŸ“Œ Replace "[email protected]" with the email of the user who needs access.


    πŸ”Ή Step 4: Verify the Shared Mailbox and Permissions

    Once configured, verify that the mailbox exists and has the correct settings.

    Check Mailbox Details

    powershellCopyEditGet-Mailbox -Identity "[email protected]" | Format-List DisplayName,PrimarySmtpAddress,RecipientTypeDetails
    

    List Users with Full Access

    powershellCopyEditGet-MailboxPermission -Identity "[email protected]" | Where-Object { $_.AccessRights -eq "FullAccess" -and $_.User -notlike "NT AUTHORITY\SELF" } | Select-Object User,AccessRights
    

    List Users with Send As Permission

    powershellCopyEditGet-RecipientPermission -Identity "[email protected]" | Where-Object { $_.AccessRights -eq "SendAs" } | Select-Object Trustee,AccessRights
    

    πŸ”Ή Step 5: Confirm the Shared Mailbox in Microsoft 365

    You can also check the mailbox in Microsoft 365 Admin Center:

    1️⃣ Sign in to Microsoft Admin Center.
    2️⃣ Go to Exchange Admin Center β†’ Recipients β†’ Shared.
    3️⃣ Locate the mailbox and confirm the settings.


    πŸš€ Conclusion

    By following these steps, you can create, manage, and verify a shared mailbox using PowerShell.

    βœ” No license required
    βœ” Centralized team email management
    βœ” Easier collaboration

    πŸ’¬ How do you manage shared mailboxes in your organization? Share your best practices in the comments below! ⬇️

    Β© 2012–2025 Jet Mariano. All rights reserved.
    For usage terms, please see the Legal Disclaimer.

  • Managing VMware with PowerCLI: Essential PowerShell Commands

    Introduction VMware PowerCLI is a powerful tool that allows administrators to manage VMware environments using PowerShell. Whether you need to create virtual machines, check resource usage, or troubleshoot storage capacity, PowerCLI provides a streamlined approach to VMware management. Below is a guide to setting up PowerCLI and using essential commands for day-to-day VMware administration.


    Step 1: Install and Import VMware PowerCLI

    Before running VMware-related PowerShell commands, ensure that VMware PowerCLI is installed on your system.

    Install-Module -Name VMware.PowerCLI -Scope CurrentUser -Force

    After installation, import the module:

    Import-Module VMware.PowerCLI

    If you encounter SSL/TLS certificate warnings while connecting, configure PowerCLI to ignore invalid certificates:

    Set-PowerCLIConfiguration -InvalidCertificateAction Ignore -Confirm:$false

    Step 2: Connect to vCenter Server

    To manage your VMware environment, you need to authenticate with vCenter:

    Connect-VIServer -Server <Your-VCenter-Server> -User <Your-Admin-User> -Password '<Your-Password>'

    Once connected, you can retrieve information about your virtual infrastructure.


    Step 3: List VMware Hosts

    To view all available VMware hosts:

    Get-VMHost

    This provides a list of all ESXi hosts, their connection status, and available resources.


    Step 4: Retrieve Virtual Machines

    To get a list of all VMs in the environment:

    Get-VM

    For details of a specific VM:

    Get-VM -Name <VM-Name>

    Step 5: Checking vSAN Datastore Usage

    One common challenge in VMware environments is monitoring vSAN datastore usage. To check storage space:

    Get-VsanSpaceUsage -Cluster <Your-Cluster-Name>

    To calculate the percentage of used space, run:

    $vsanUsage = Get-VsanSpaceUsage -Cluster <Your-Cluster-Name>
    $usedPercentage = 100 - (($vsanUsage.FreeSpaceGB / $vsanUsage.CapacityGB) * 100)
    "vSAN Datastore is currently {0:N2}% full" -f $usedPercentage

    Step 6: Creating a New Virtual Machine

    If you need to create a new VM:

    New-VM -Name <VM-Name> -VMHost <Host-Name> -Datastore <Datastore-Name> -DiskGB 50 -MemoryGB 4 -NumCPU 2

    This command creates a VM with 50GB disk, 4GB RAM, and 2 CPUs.


    Step 7: Cloning an Existing Virtual Machine

    To create a clone of an existing VM:

    New-VM -Name <New-VM-Name> -VM <Source-VM-Name> -Datastore <Datastore-Name> -VMHost <Target-Host>

    Step 8: Managing VM Power States

    To power on a VM:

    Start-VM -VM <VM-Name>

    To shut down a VM:

    Stop-VM -VM <VM-Name> -Confirm:$false

    To restart a VM:

    Restart-VM -VM <VM-Name> -Confirm:$false

    Step 9: Deleting a Virtual Machine

    If a VM is no longer needed, you can remove it permanently:

    Remove-VM -VM <VM-Name> -DeletePermanently -Confirm:$false

    Step 10: Checking for Leftover Files in vSAN

    Even after deleting a VM, some files may remain in the datastore. You can check for orphaned files:

    Get-Datastore -Name <Datastore-Name> | Get-ChildItem -Recurse | Where-Object { $_.Name -like "*<VM-Name>*" }

    To manually remove leftover files:

    Remove-Item -Path "vmstore:\<Datastore-Name>\FolderName\<VM-Name>.vmdk" -Confirm:$false

    Final Thoughts

    Using PowerCLI to manage VMware environments improves efficiency and automation. Whether you need to monitor vSAN usage, create new VMs, or automate backups, PowerCLI provides a flexible solution. Keep this guide handy for reference as you work with VMware environments.

    Have any useful PowerCLI commands that you frequently use? Share them in the comments below! πŸš€

    Β© 2012–2025 Jet Mariano. All rights reserved.
    For usage terms, please see the Legal Disclaimer.

  • How to Investigate and Secure a Compromised Microsoft 365 Account After a Phishing Attack

    Introduction

    Phishing attacks are one of the most common cybersecurity threats that IT administrators face. A single click on a malicious email link can lead to credential theft, data exfiltration, or malware infections.

    This guide provides a step-by-step approach to investigating and securing a potentially compromised account in Microsoft 365 using PowerShell and the Microsoft Security Portal.


    πŸ”Ή Immediate Response: Disconnect & Secure the Affected Computer

    Before investigating, act fast to prevent further damage:

    1️⃣ Shut down the compromised computer immediately.
    2️⃣ Disconnect from the network (unplug Ethernet, disable Wi-Fi).
    3️⃣ Reset the password for the affected user.
    4️⃣ Revoke all active sessions to log out any potential attacker.

    PowerShell Command to Revoke Sessions:

    powershellCopyEditRevoke-AzureADUserAllRefreshToken -ObjectId "[email protected]"
    

    Reset MFA to Prevent Unauthorized Re-Login:

    powershellCopyEditReset-MsolStrongAuthenticationMethodByUpn -UserPrincipalName "[email protected]"
    

    πŸ”Ή Step 1: Check for Unauthorized Sign-ins in Azure AD

    Use Azure AD Sign-in Logs to check for suspicious login attempts.

    PowerShell Command to Retrieve Sign-in Logs:

    powershellCopyEditConnect-AzureAD
    Get-AzureADAuditSignInLogs -Filter "status/errorCode ne '0'"
    

    βœ… Alternative:

    πŸ” Red Flags:

    🚩 Logins from unexpected locations or devices
    🚩 Multiple failed MFA attempts
    🚩 Impossible travel scenarios (e.g., two logins from different continents within minutes)


    πŸ”Ή Step 2: Investigate Phishing Emails Across the Organization

    If an attacker sent phishing emails to multiple employees, run a Compliance Search to identify all affected mailboxes.

    PowerShell Command to Search All Mailboxes for Suspicious Emails:

    powershellCopyEditNew-ComplianceSearch -Name "CompanyPhishingScan" -ExchangeLocation All -ContentMatchQuery 'has:attachment OR has:link'
    Start-ComplianceSearch -Identity "CompanyPhishingScan"
    

    Check Results:

    powershellCopyEditGet-ComplianceSearch -Name "CompanyPhishingScan" | Select Name, Status, Items
    

    If Phishing Emails Are Found, Remove Them:

    powershellCopyEditNew-ComplianceSearchAction -SearchName "CompanyPhishingScan" -Purge -PurgeType SoftDelete
    

    🚨 Use HardDelete only if emails must be permanently removed.


    πŸ”Ή Step 3: Check & Remove Hidden Forwarding Rules

    Attackers often set up automatic forwarding to steal emails.

    Check for Forwarding Rules:

    powershellCopyEditGet-Mailbox -Identity "[email protected]" | Select ForwardingAddress, ForwardingSmtpAddress
    

    Disable Auto-Forwarding if Found:

    powershellCopyEditSet-Mailbox -Identity "[email protected]" -ForwardingAddress $null -ForwardingSmtpAddress $null
    

    πŸ”Ή Step 4: Scan the Compromised Computer Before Reconnecting

    Since a phishing link was clicked, scan the system for malware before reconnecting to the network.

    Offline Windows Defender Scan:

    powershellCopyEditStart-MpScan -ScanType FullScan
    

    If Threats Are Found, Remove Them:

    powershellCopyEditRemove-MpThreat -AllThreats
    

    For a Deep Rootkit Scan, Use Windows Defender Offline:

    powershellCopyEditStart-MpWDOScan
    

    βœ… This will restart the system and scan before Windows boots.


    πŸ”Ή Step 5: Implement Long-Term Protection Measures

    βœ… Enable Safe Links & Safe Attachments in Microsoft Defender

    • Safe Links: Blocks phishing links before users click them.
    • Safe Attachments: Scans email attachments for malware before delivery.

    Enable Safe Links Policy:

    powershellCopyEditSet-SafeLinksPolicy -Identity "Default" -EnableSafeLinks $true -TrackClicks $true
    

    Enable Safe Attachments Policy:

    powershellCopyEditSet-MalwareFilterPolicy -Identity "Default" -EnableSafeAttachmentsForMail $true
    

    βœ… Educate Users on Phishing Awareness

    πŸ”Ή Enable the “Report Message” button in Outlook so employees can easily flag suspicious emails.
    πŸ”Ή Train employees to recognize phishing emails:
    βœ” Unexpected links
    βœ” Urgent language
    βœ” Sender impersonation


    πŸš€ Final Wrap-Up: Is the Account and System Secure?

    βœ” Account fully secured: No unauthorized logins, MFA reset, all active sessions revoked.
    βœ” Email threats removed: No phishing emails remain in any mailbox.
    βœ” PC scanned and clean: No malware detected before reconnecting.
    βœ” Long-term protections enabled: Safe Links, Safe Attachments, user education.

    βœ… By following these steps, IT admins can quickly contain and prevent phishing incidents in Microsoft 365! πŸš€


    πŸ’¬ What’s Next?

    How does your organization handle phishing attacks? Share your best practices in the comments below! ⬇️

    Β© 2012–2025 Jet Mariano. All rights reserved.
    For usage terms, please see the Legal Disclaimer.

  • How to Prevent Windows 10 Updates and Manage Remote Sessions Without Rebooting

    Introduction
    In many enterprise environments, automatic Windows 10 updates can disrupt critical applications. This guide provides step-by-step instructions on preventing updates, forcefully logging off users without rebooting, and managing remote machines efficiently using PowerShell, Command Prompt, and PsExec.


    Step 1: Prevent Windows 10 from Installing Updates

    Option 1: Disable Windows Update Service (Quick & Easy)

    1. Open Run (Win + R), type services.msc, and press Enter.
    2. Locate Windows Update in the list.
    3. Right-click and select Properties.
    4. Set Startup type to Disabled.
    5. Click Stop, then Apply and OK.

    πŸ’‘ This prevents Windows from automatically downloading and installing updates.

    Option 2: Use Group Policy to Block Updates

    1. Open Run (Win + R), type gpedit.msc, and press Enter.
    2. Navigate to:Computer Configuration β†’ Administrative Templates β†’ Windows Components β†’ Windows Update
    3. Double-click Configure Automatic Updates.
    4. Select Disabled, then click Apply and OK.

    Option 3: Delete Pending Updates Using PowerShell

    If Windows updates are already downloaded and pending installation:

    Stop-Service wuauserv -Force
    Stop-Service bits -Force
    Remove-Item -Path "C:\Windows\SoftwareDistribution\Download\*" -Recurse -Force
    Start-Service wuauserv
    Start-Service bits

    πŸ’‘ This clears pending updates, preventing them from being installed.


    Step 2: Completely Cancel Pending Updates and Remove Notification

    Option 1: Clear the Update Queue from Windows Update

    If stopping services alone doesn’t remove pending updates, run this in PowerShell:

    Remove-Item -Path "C:\Windows\WinSxS\pending.xml" -Force -ErrorAction SilentlyContinue
    Remove-Item -Path "C:\Windows\SoftwareDistribution\*" -Recurse -Force

    πŸ’‘ This removes Windows’ record of pending updates.

    Option 2: Flush Update Status from Windows Registry

    If the notification persists, remove any registry traces of pending updates:

    Remove-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update" -Name "RebootRequired" -ErrorAction SilentlyContinue
    Remove-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Services\Pending" -ErrorAction SilentlyContinue

    πŸ’‘ This tells Windows that no updates are waiting for a reboot.

    Option 3: Reset Windows Update Components

    Run the following commands in CMD (Admin):

    net stop wuauserv
    net stop cryptsvc
    net stop bits
    net stop msiserver
    ren C:\Windows\SoftwareDistribution SoftwareDistribution.old
    ren C:\Windows\System32\catroot2 Catroot2.old
    net start wuauserv
    net start cryptsvc
    net start bits
    net start msiserver

    πŸ’‘ This resets Windows Update components so the system forgets pending updates.

    Force Windows to Acknowledge No Updates Are Pending

    Run:

    wuauclt.exe /resetauthorization /detectnow

    or

    gpupdate /force

    πŸ’‘ This forces Windows to recheck update policies and clear any pending update flags.

    Reboot Without Installing Updates

    To make sure Windows doesn’t install the update after a reboot, run:

    shutdown /r /t 0

    πŸ’‘ This reboots without triggering pending updates.


    Step 3: Remotely Log Off a User Without Rebooting

    Option 1: Using PowerShell (Requires Admin Privileges)

    1. Open PowerShell as Administrator.
    2. Run:query user /server:RemotePCName
    3. Identify the Session ID of the user you want to log off.
    4. Log them off with:logoff <SessionID> /server:RemotePCName

    πŸ’‘ This logs off the user without shutting down the VM.

    Option 2: Using PsExec (If PowerShell Remoting is Blocked)

    1. Download PsExec.
    2. Extract it to C:\PSEXEC.
    3. Open Command Prompt as Administrator.
    4. Navigate to the PsExec folder:cd C:\PSEXEC
    5. Check who is logged in:psexec \RemotePCName -u Administrator -p YourPassword query session
    6. Log off the user:psexec \RemotePCName -u Administrator -p YourPassword logoff <SessionID>

    πŸ’‘ This method works even if WinRM and RPC are blocked.

    Option 3: Using Command Prompt (WMI-Based Logoff)

    If PsExec fails, try using WMI:

    wmic /node:RemotePCName /user:Administrator /password:YourPassword computersystem where name="RemotePCName" call Win32Shutdown 4

    πŸ’‘ This forces all logged-in users to log off without rebooting! πŸš€


    Step 4: Ensure Remote Management Works for Future Use

    Once you regain access, run this on the remote VM to prevent future lockouts:

    Enable-PSRemoting -Force
    Set-Service -Name RemoteRegistry -StartupType Automatic
    New-NetFirewallRule -DisplayName "Allow RDP and RPC" -Direction Inbound -Protocol TCP -LocalPort 135,3389 -Action Allow

    πŸ’‘ This allows future remote PowerShell and PsExec commands to execute successfully.


    Conclusion

    By following this guide, you can prevent Windows 10 from automatically updating, remotely log off users without rebooting, and ensure seamless remote access to your systems. This is critical for IT environments where stability is a priority.

    Let me know if you need additional troubleshooting steps!

    Β© 2012–2025 Jet Mariano. All rights reserved.
    For usage terms, please see the Legal Disclaimer.

  • Why Azure Cloud Shell is Better?

    If you’re an IT professional or cloud enthusiast, you’ve likely used PowerShell to manage Azure resources. But did you know there’s a better way? Azure Cloud Shell offers a streamlined, cloud-based command-line experience that makes managing Azure easier than ever.


    πŸš€ What is Azure Cloud Shell?

    Azure Cloud Shell is a browser-based command-line tool that lets you manage Azure resources without the need to install or configure anything on your local machine. It supports both PowerShell and Bash, giving you flexibility depending on your workflow.


    πŸ”₯ Why Use Azure Cloud Shell Over Local PowerShell?

    βœ… Pre-installed Azure Modules – No need to manually install or update Az PowerShell modules. βœ… Persistent Environment – Your session and files persist across devices. βœ… Works on Any OS – Since it’s browser-based, you can use it on Windows, Mac, or Linux. βœ… Built-in Authentication – No need to repeatedly sign in to Azure. βœ… Seamless Access to Azure Resources – Direct integration with your Azure subscriptions. βœ… Supports Both Bash & PowerShell – Choose the scripting environment that works best for you.


    πŸ”Ž How to Access Azure Cloud Shell

    1. Go to the Azure Portal: Open portal.azure.com.
    2. Locate the Cloud Shell Icon: Look for the PowerShell logo (or the Bash icon) at the top-right of the screen.
    3. Click to Launch: This will open a terminal at the bottom of the Azure Portal.
    4. Sign In with Your Credentials: If prompted, sign in to Azure.
    5. Authenticate: If needed, go to Microsoft Device Login and enter the code displayed.

    πŸ”§ Basic Azure Cloud Shell Commands to Get Started

    πŸ”Ή Check Your Active Subscription

    Get-AzContext  # Displays your current subscription

    πŸ”Ή List All Azure Subscriptions

    Get-AzSubscription  # Shows all available subscriptions

    πŸ”Ή List All Resource Groups

    Get-AzResourceGroup  # Displays all resource groups in your active subscription

    πŸ”Ή List All Virtual Machines

    Get-AzVM  # Lists all VMs in your subscription

    πŸ”Ή Check Azure AD Users

    Get-AzADUser -First 10  # Retrieves the first 10 users in Azure AD

    πŸ”Ή Manage Storage Accounts

    Get-AzStorageAccount  # Lists all storage accounts in your subscription

    ⚑ Why IT Admins Love Azure Cloud Shell

    Azure Cloud Shell makes it easier to manage Azure environments without worrying about PowerShell version mismatches or module updates. It’s accessible from anywhere, even on a mobile device, making it a go-to tool for IT admins who need quick access to their cloud resources.


    πŸ’‘ Final Thoughts

    If you’re still using local PowerShell to manage Azure, it’s time to upgrade your workflow. Azure Cloud Shell offers convenience, security, and efficiencyβ€”all without the hassle of local configurations.

    Try it today and take your Azure management to the next level! πŸš€

  • Removing Pending Updates on Windows 10 and Windows 11

    Windows updates can sometimes cause issues, especially when they force restarts or interfere with applications. This guide will show you how to remove pending updates to prevent Windows from installing them. These steps apply to both Windows 10 and Windows 11.

    Step 1: Stop Windows Update Services

    Before removing pending updates, you need to stop the Windows Update service.

    Open Command Prompt (Admin) and run:

    net stop wuauserv
    net stop bits
    net stop cryptsvc

    Step 2: Delete Pending Updates

    Once the services are stopped, delete the update files stored in SoftwareDistribution and WinSxS.

    Command Prompt Method:

    del /f /s /q C:\Windows\SoftwareDistribution\DataStore\* 
    del /f /s /q C:\Windows\SoftwareDistribution\Download\* 
    del /f /s /q C:\Windows\WinSxS\pending.xml

    PowerShell Method:

    Remove-Item -Path "C:\Windows\SoftwareDistribution\DataStore\*" -Force -Recurse
    Remove-Item -Path "C:\Windows\SoftwareDistribution\Download\*" -Force -Recurse
    Remove-Item -Path "C:\Windows\WinSxS\pending.xml" -Force

    If access is denied to pending.xml, take ownership and modify permissions first:

    takeown /f C:\Windows\WinSxS\pending.xml /A
    icacls C:\Windows\WinSxS\pending.xml /grant Administrators:F

    Then, retry deleting the file.

    Step 3: Restart Windows Update Services

    Once files are deleted, restart the Windows Update services:

    net start wuauserv
    net start bits
    net start cryptsvc

    Windows 11 Extra Step

    On Windows 11, Tamper Protection in Windows Security may prevent modification of update files. If you encounter issues:

    1. Open Windows Security
    2. Navigate to Virus & Threat Protection > Manage Settings
    3. Disable Tamper Protection temporarily
    4. Follow the steps above and re-enable it after removal.

    Conclusion

    By following these steps, you can effectively remove pending Windows updates, preventing them from being installed. This is particularly useful for IT professionals managing production-critical systems.

  • How to Remove RDP Sessions Using CMD and PowerShell

    Introduction In IT administration, managing Remote Desktop Protocol (RDP) sessions is essential to maintain system security and performance. Whether you need to log off a disconnected session or forcefully remove an active session, using Command Prompt (CMD) or PowerShell can streamline the process. This guide will walk you through the methods to list, disconnect, and remove RDP sessions.


    Step 1: List Active RDP Sessions Before removing a session, you need to check which users are currently logged in. Run the following command in CMD:

    query session /server:localhost

    This will display all active and disconnected sessions along with their IDs.

    Alternatively, in PowerShell, use:

    qwinsta /server:localhost

    Both commands provide the session ID required to log off a user.


    Step 2: Log Off an RDP Session Once you have the session ID, you can log off a user session using CMD:

    logoff <SessionID> /server:localhost

    Example:

    logoff 2 /server:localhost

    This will terminate session ID 2.

    In PowerShell, use:

    rwinsta <SessionID>

    Example:

    rwinsta 2

    This will remove session ID 2 from the system.


    Step 3: Forcefully Remove a Stuck RDP Session If a session does not close properly, use this CMD command:

    taskkill /F /IM mstsc.exe

    This will forcefully terminate all remote desktop connections.

    In PowerShell, use:

    Stop-Process -Name mstsc -Force

    This achieves the same result.


    Conclusion Managing RDP sessions efficiently helps prevent resource exhaustion and unauthorized access. By using CMD or PowerShell, IT admins can quickly remove inactive or unresponsive RDP sessions, ensuring smooth operations. Bookmark these commands for future reference!

  • Mastering AZ-104: Essential Labs, PowerShell, and Tricky Concepts

    Introduction

    Passing the AZ-104: Microsoft Azure Administrator exam requires hands-on experience with Azure services. This guide provides essential labs, PowerShell/CLI commands, and explanations of tricky concepts to help you prepare efficiently.


    1️⃣ Compute (Virtual Machines & Availability)

    Lab: Deploy a VM using PowerShell

    New-AzVM -ResourceGroupName "TestRG" -Name "JetVM" -Location "EastUS" -Size "Standard_B2s" -Credential (Get-Credential)

    βœ… Key Concepts:

    • VM Backup & Disaster Recovery β†’ Use Azure Backup Vault.
    • High Availability β†’ Deploy VMs in Availability Zones.

    2️⃣ Networking (VNETs, NSGs, VPNs, Peering)

    Lab: Create a Virtual Network with Subnets and an NSG

    New-AzVirtualNetwork -ResourceGroupName "TestRG" -Name "JetVNet" -Location "EastUS" -AddressPrefix "10.1.0.0/16"

    βœ… Key Concepts:

    • VNet Peering vs VPN Gateway:
      • VNet Peering β†’ Low latency, same region.
      • VPN Gateway β†’ Cross-region, IPSec tunnels.

    3️⃣ Storage (Blob, Files, Disks, Backups)

    Lab: Create a Storage Account

    New-AzStorageAccount -ResourceGroupName "TestRG" -Name "jetstorage01" -SkuName "Standard_LRS" -Location "EastUS"

    βœ… Key Concepts:

    • Storage Tiers:
      • Hot β†’ Frequent access
      • Cool β†’ Infrequent access
      • Archive β†’ Long-term storage, lowest cost

    4️⃣ Identity & Access Management (IAM, RBAC, MFA)

    Lab: Assign RBAC Role to a User

    New-AzRoleAssignment -SignInName "<user-email>" -RoleDefinitionName "Reader" -Scope "/subscriptions/your-subscription-id"

    βœ… Key Concepts:

    • RBAC vs Conditional Access:
      • RBAC β†’ Controls Azure resources.
      • Conditional Access β†’ Controls sign-in policies (MFA, device compliance).

    5️⃣ Monitoring & Security (Azure Monitor, Defender for Cloud)

    Lab: Set Up Alerts for High CPU Usage

    New-AzMetricAlertRule -ResourceGroup "TestRG" -Name "CPUAlert" -TargetResourceId "/subscriptions/your-subscription-id/resourceGroups/TestRG/providers/Microsoft.Compute/virtualMachines/JetVM" -MetricName "Percentage CPU" -Threshold 80 -Operator GreaterThan -WindowSize 5m -EvaluationFrequency 1m

    βœ… Key Concepts:

    • Azure Monitor vs Log Analytics:
      • Azure Monitor β†’ Collects logs + metrics.
      • Log Analytics β†’ Queries & analyzes logs.

    πŸš€ Final Exam Prep Tips

    βœ… Hands-on practice in Azure Free Tier + Pluralsight Labs. βœ… Take full-length practice tests (MeasureUp, Tutorials Dojo). βœ… Master PowerShell/CLI for automation scenarios. βœ… Simulate exam conditions (time yourself, no distractions).


    πŸ“Œ Conclusion

    By following these structured labs and understanding key concepts, you’ll be well-prepared to ace AZ-104. Keep practicing, and best of luck on your certification journey! πŸš€

    πŸ“ Want more Azure tips? Follow my blog for more deep dives into Microsoft certifications and cloud solutions!

  • Securing Remote Work: How to Protect Your Computer When Using VPN and RDP

    With the rise of remote work and hybrid environments, many IT professionals access their work machines using VPN and RDP (Remote Desktop Protocol). While this setup provides flexibility, it also presents security risksβ€”especially when working in a cross-domain network or dealing with multiple IT teams.

    As an IT professional with experience in Citrix VDI for banking and enterprise security, I’ve implemented best practices to ensure my remote work setup is secure against unauthorized access. Here’s how you can do the same.


    πŸ” Understanding the Security Risks of VPN + RDP

    A typical work-from-home setup involves:
    βœ… Connecting to a corporate VPN (e.g., Cisco AnyConnect, Fortinet, or Palo Alto GlobalProtect)
    βœ… Using RDP (Remote Desktop Protocol) to access your work machine

    However, if not properly secured, this configuration could expose your computer to:
    ⚠ Unwanted access from other IT personnel within the VPN network
    ⚠ Brute-force RDP attacks if port 3389 is open
    ⚠ Drive redirection vulnerabilities, where attackers can view or copy your files
    ⚠ Misconfigured VPN routes, allowing unauthorized users to connect to your machine

    To prevent these risks, I follow a strict security protocol when using VPN and RDP.


    πŸ›‘οΈ Step-by-Step Guide: How to Secure Your Work Computer When Using VPN + RDP

    1️⃣ Enforce Network Level Authentication (NLA) for RDP

    Network Level Authentication (NLA) ensures that only authenticated users can initiate RDP sessions, blocking unauthorized login attempts.

    βœ… How to enable NLA:

    1. Open System Properties (sysdm.cpl)
    2. Go to the Remote tab
    3. βœ… Check “Allow connections only from computers running Remote Desktop with Network Level Authentication”
    4. Click Apply > OK

    πŸ”Ή Why it matters? Without NLA, an attacker can initiate an RDP connection and attempt brute-force attacks before authentication.


    2️⃣ Restrict RDP Access to VPN-Only IP Ranges

    By default, Windows allows RDP connections from any network. To prevent unauthorized access, restrict RDP connections only to your VPN subnet.

    βœ… How to block all external RDP access except your VPN subnet:

    1. Open Windows Defender Firewall
    2. Navigate to Advanced Settings > Inbound Rules
    3. Find Remote Desktop – User Mode (TCP-In)
    4. Right-click > Properties > Scope
    5. Under Remote IP Address, choose These IP addresses
    6. Add only your VPN subnet (e.g., 172.16.104.0/24)
    7. Click Apply > OK

    πŸ”Ή Why it matters? Even if someone inside your network tries to RDP into your machine, their connection will be blocked unless they are in the allowed VPN range.


    3️⃣ Disable Drive Redirection in RDP

    RDP allows drive redirection by default, which means that if an attacker gains access, they can browse and copy files from your local machine.

    βœ… How to disable RDP drive redirection:

    1. Open Group Policy Editor (gpedit.msc)
    2. Navigate to: pgsqlCopy codeComputer Configuration > Administrative Templates > Windows Components > Remote Desktop Services > Remote Desktop Session Host > Device and Resource Redirection
    3. Find “Do not allow drive redirection”
    4. Set it to Enabled
    5. Click Apply > OK

    πŸ”Ή Why it matters? This prevents your local drives from being exposed during RDP sessions.


    4️⃣ Monitor RDP Access Logs for Unauthorized Connections

    Since you’re the only one RDPing into your machine, it’s important to monitor login attempts to detect any suspicious activity.

    βœ… How to check RDP login logs in Event Viewer:

    1. Open Event Viewer (eventvwr.msc)
    2. Navigate to: nginxCopy codeWindows Logs > Security
    3. Look for:
      • Event ID 4624 (successful logins)
      • Event ID 4625 (failed logins)

    πŸ”Ή Why it matters? If you see failed logins from unknown IPs, someone may be trying to brute-force your RDP connection.


    5️⃣ Disable Remote Access for Unauthorized Users

    IT admins in your network may have elevated privileges, allowing them to remotely manage your system. To block unauthorized admin access, you can disable remote administration tools.

    βœ… How to remove unauthorized administrators:

    1. Open PowerShell as Administrator
    2. Run the following command to list local administrators: powershellCopy codenet localgroup Administrators
    3. If you see any unauthorized users, remove them: powershellCopy codenet localgroup Administrators "DOMAIN\Username" /delete

    πŸ”Ή Why it matters? Even with VPN access, they won’t be able to take control of your system.


    πŸ’‘ Alternative: Using Citrix VDI Instead of RDP for Secure Access

    Since I’ve worked with Citrix Virtual Desktop Infrastructure (VDI) for banks, I know that virtual desktops eliminate most RDP risks. Instead of exposing RDP ports, a Citrix setup allows users to access their workstations securely via a web portal.

    βœ… Why Citrix VDI is better than RDP over VPN:
    πŸš€ No direct RDP connection – Reduces attack surface
    πŸš€ User sessions are isolated – Prevents unauthorized access
    πŸš€ Secured with multi-factor authentication (MFA) – Extra security

    If your organization supports it, using Citrix or Windows Remote Desktop Web Access (RD Web) is a safer alternative.


    πŸ”Ž Final Thoughts

    Working remotely via VPN + RDP is convenient, but it must be properly secured to prevent unauthorized access and IT snooping. By implementing:
    βœ… Network Level Authentication (NLA)
    βœ… Restricting RDP to VPN-only IP ranges
    βœ… Disabling drive redirection
    βœ… Monitoring login logs
    βœ… Removing unauthorized admin users

    You can ensure that your remote work environment remains private and secure.

    πŸ”Ή If you’re managing an enterprise network, consider moving to Citrix VDI or Windows RD Web for an extra layer of security.

    πŸ’‘ Have questions about securing your remote access? Drop a comment below!

error: Content is protected !!