Useful Tools & Scripts for IT Pros

On this page you can find a selection of custom-made tools & scripts designed for IT professionals. I compile these tools myself as part of my day job, finding them to be extremely handy - and so I've decided to share them for you to download.

Email Address List Formatter

Prerequisites: This tool requires Python and the pyperclip module to be installed on your local machine.

Description / Use Case: I designed this tool to take a space-separated list of email addresses (for example, when copied from an XLS export of MS365 user accounts) and format it into a space and comma separated list, usable in PowerShell and batch scripts.

Example:

Input: john.smith@domain.com jane.smith@domain.com

Output: john.smith@domain.com, jane.smith@domain.com

To install the pyperclip module, run the Python launcher and enter 'pip install pyperclip'. 

Python Script Download: 


Continuous Ping with Time Stamp, Written to TXT File

Prerequisites: This script requires Windows PowerShell to run.

Description / Use Case: A quick and effortless way to monitor connectivity between endpoints continuously, with a timestamp for each ping request, with output written to a TXT file for review.

Press CTRL + C on your keyboard in the PowerShell window to stop the script and complete the TXT output.

PowerShell Script:

ping.exe -t [HOSTNAME/IP] -l [PACKET SIZE] |Foreach{"{0} - {1}" -f (Get-Date),$_} > [OUTPUT PATH]


Top-Twenty Largest Files Scanner

Prerequisites: This script requires Windows PowerShell to run.

Description / Use Case: Scans the given file system and identifies & prints the top 20 results in terms of file size, with the full file path.

Please note if you have a cloud storage drive such as OneDrive connected to the specified root directory, the cloud files may be downloaded & cached locally for the script to scan the file sizes.

PowerShell Script:

# Define the root directory you want to scan
$rootDirectory = "C:\"

# Get all files in the specified directory and subdirectories
$allFiles = Get-ChildItem -Path $rootDirectory -File -Recurse

# Sort the files by size in descending order and select the top 20
$top20Files = $allFiles | Sort-Object Length -Descending | Select-Object -First 20

# Initialize a progress bar
$progress = 0
$progressTotal = $top20Files.Count

# Display the top 20 files and their sizes in GB
foreach ($file in $top20Files) {
    $sizeInGB = [math]::Round(($file.Length / 1GB), 2)
    Write-Host ("File: " + $file.FullName)
    Write-Host ("Size (GB): " + $sizeInGB)
    Write-Host ("-----------------------------")

    # Update the progress bar
    $progress++
    Write-Progress -Activity "Scanning Files" -Status "Progress" -PercentComplete (($progress / $progressTotal) * 100)
}

# Complete the progress bar
Write-Progress -Completed

# Optionally, you can export the results to a CSV file
$top20Files | Export-Csv -Path "Top20Files.csv" -NoTypeInformation

 

 


Comments

Popular Posts