I hereby claim:
- I am aev-mambro2 on github.
- I am aveltstramambro (https://keybase.io/aveltstramambro) on keybase.
- I have a public key ASAaQpE3YDIgBdp1YgUMN2YgKm-V7HCAWHHESAaJV1JbSQo
To claim this, I am signing this object:
| <# 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. | |
| # |
| <# 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 |
| <# 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 | |
| #> |
| $targetServer = "netbui-server-name"; | |
| $inputFolder = "C:\Users\Me\Documents\scheduled-task-exports\the-date\$($targetServer)"; | |
| $tasksNamespace = "\my\Scheduled\Tasks\Path"; | |
| $taskRunnerUserName = "WHO?"; | |
| $taskRunnerPassword = "how?"; | |
| $c = New-CimSession -ComputerName $targetServer; | |
| Get-ChildItem -Recurse -Path (Join-Path $inputFolder $tasksNamespace) -Filter "*.xml" | foreach { | |
| $newTaskName = $_.BaseName; | |
| $newTaskPath = $_.DirectoryName.Replace($inputFolder,""); |
| $servers = @{ | |
| "netbui-server-name" = @("\task\scheduler\path\*"), | |
| "other-netbui-server" = @( | |
| "\task\scheduler\path1\*", | |
| "\task\scheduler\path2\*", | |
| ) | |
| } | |
| $outputFolder = "C:\Users\Me\Documents\scheduled-task-exports\"; | |
| foreach ($h in $servers.Keys) { |
| /* | |
| * Gradle user guide: https://docs.gradle.org/ | |
| * Gradle install: https://gradle.org/install/ | |
| * Based on Gradle version 5.4.1 | |
| * @author A.E.Veltstra | |
| * @since 2.20.0121.1100 | |
| * @version 2.21.302.1025 | |
| */ | |
| import io.franzbecker.gradle.lombok.task.DelombokTask |
| -- Using common table expressions | |
| with | |
| -- Supply list A | |
| a (i) as (select i from (values | |
| ('6GA00215S'), | |
| ('6GU00208S'), | |
| ('6PO00396I'), | |
| ('6PO00398I') | |
| ) A(i)), | |
| -- Supply list B |
I hereby claim:
To claim this, I am signing this object:
| <# | |
| # Goal: to run a scheduled task on a remote windows server. | |
| # Requirements: user must have CIM, WMI, and task admin privileges on the remote server. | |
| # (c) 2021, A.E.Veltstra | |
| #> | |
| # Access the remote server. The computer name should be the short NETBUI name, without a domain. | |
| $_session = New-CimSession -ComputerName "NETBUI NAME"; | |
| # Point to where the task is stored in the task scheduler. The opening \ points to what the |
| #Based on the article by Phil Factor, 2012, for Redgate: | |
| #https://www.red-gate.com/simple-talk/sql/db-administration/automated-script-generation-with-powershell-and-smo/ | |
| Write-Host "This script writes 1 file that contains the SQL to regenerate an SQL Server Database. What file name should the script give it?"; | |
| $save_chooser = New-Object -Typename System.Windows.Forms.SaveFileDialog; | |
| $save_chooser.ShowDialog(); | |
| $write_output_to=$save_chooser.FileName; | |
| write-host "Saving to: " $write_output_to | |
| $server_instance=(Read-Host -Prompt "Which server?"); | |
| $db_name=(Read-Host -Prompt "Which database?"); |