Skip to content

Instantly share code, notes, and snippets.

View aev-mambro2's full-sized avatar

André E. Veltstra aev-mambro2

View GitHub Profile
@aev-mambro2
aev-mambro2 / list-scheduled-tasks.ps1
Created August 18, 2021 20:07
list-scheduled-tasks
<# List Scheduled Tasks
# This script lists scheduled tasks of all known Windows-operated servers,
# and places each task's path into a file specific to the server.
#
# Run this prior to check-api-tasks, which uses the output files.
#
# Author: A.E.Veltstra
# Version: 2.21.818.1243
#>
@aev-mambro2
aev-mambro2 / check-scheduled-tasks.ps1
Created August 19, 2021 11:52
check-scheduled-tasks
<# Check API Tasks
# This script checks scheduled tasks of all known Windows-operated servers,
# determines whether any has missed its scheduled execution,
# and emails those tasks with server name and amount of missed executions.
#
# Run this after list-api-tasks, which creates the input files that this script
# expects.
#
# Author: A.E.Veltstra
# Version: 2.21.818.1246
@aev-mambro2
aev-mambro2 / analyze-scheduled-task-run-durations.ps1
Last active September 30, 2021 18:10
analyze-scheduled-task-run-durations
<# Analyze normal run duration of scheduled tasks.
# Gathers insight into how long tasks run, analyzes
# which tasks run shorter or longer than normal,
# reports back to console, and writes out its report
# as a CSV (spreadsheet).
#
# The script assumes that the user account running it
# has access to the computer and is allowed to read its
# event log.
#
@aev-mambro2
aev-mambro2 / multi-analyze-task-run-durations.ps1
Created September 30, 2021 18:06
Multithreaded Analyze Scheduled Task Run Durations (Windows Powershell, DevOps)
<# Analyze normal run duration of scheduled tasks.
# Gathers insight into how long tasks run, analyzes
# which tasks run shorter or longer than normal,
# reports back to console, and writes out its report
# as a CSV (spreadsheet).
#
# The script assumes that the user account running it
# has access to the computer and is allowed to read
# its event log.
#
@aev-mambro2
aev-mambro2 / gist:a10e55c94b76392914ef26e51610aa36
Created October 21, 2021 18:59
Start a remote console connection to a remote Windows server with admin privileges
mstsc -v:server.domain.edu /admin /F -console
@aev-mambro2
aev-mambro2 / powershell-send-email-via-ms-outlook-365.ps
Created January 3, 2022 13:44
powershell-send-email-via-ms-outlook-365-with-attachments
$who = New-Object System.Management.Automation.PSCredential(
"[email protected]",
(ConvertTo-SecureString "TheSecret" -AsPlainText -Force)
) -ErrorAction Stop;
#NOTE: this version of Send-MailMessage does NOT have a -ReplyTo parameter.
Send-MailMessage `
-From [email protected] `
-Subject $("{0} Reports, dd. {1}" -f $files_count, $now) `
-To undisclosed recipients `
-Body $([System.String]::Concat(
@aev-mambro2
aev-mambro2 / powershell-get-20-largest-folders-in-current-location.ps
Last active January 3, 2022 14:14
powershell-get-20-largest-folders-in-current-location
Function Get-FolderSize {
BEGIN { $fso = New-Object -ComObject Scripting.FileSystemObject }
PROCESS {
$path = $input.fullname
$folder = $fso.GetFolder($path)
@aev-mambro2
aev-mambro2 / excel-vba-convert-image-link-to-image.vbs
Created March 2, 2022 15:38
Excel VBA: convert an image link into an actual image
@aev-mambro2
aev-mambro2 / gradle-deploy-multiple-projects-to-multiple-targets.gradle
Created March 10, 2022 13:41
How to deploy from multiple projects to multiple target servers using Gradle CDCI
["server-1", "server-2", "server-3"].each { server ->
task "deploy-to-$server" (type: Copy) {
description: "Copies the project executables to $server"
enabled: true
group: "distribution"
afterEvaluate { Project project ->
from: "$distDir/$distZip"
into: "\\\\$server\\share\\${project.name}\\"
}
}
@aev-mambro2
aev-mambro2 / start-windows-taskschd-as-system.bat
Created March 28, 2022 17:43
How to start Windows Task Scheduler as System
psexec -accepteula -i -d -s mmc taskschd.msc