Skip to content

Instantly share code, notes, and snippets.

@mrknmc
mrknmc / wsus-update.ps1
Last active August 29, 2016 04:21 — forked from jacobludriks/wsus-update.ps1
wsus-update
Function WSUSUpdate {
$LogFile = "UpdateLogs\" + (Get-Date -format yyyy-MM-dd--HH-mm) + ".log"
Start-transcript $LogFile
$Criteria = "IsInstalled=0 and Type='Software'"
$Searcher = New-Object -ComObject Microsoft.Update.Searcher
try {
$SearchResult = $Searcher.Search($Criteria)
[Object[]] $Critical = $SearchResult.updates | where { $_.MsrcSeverity -eq "Critical" }
[Object[]] $Important = $SearchResult.updates | where { $_.MsrcSeverity -eq "Important" }
[Object[]] $Moderate = $SearchResult.updates | where { $_.MsrcSeverity -eq "Moderate" }
@liquidgecka
liquidgecka / cron_helper.sh
Last active September 28, 2023 15:35
Cron helper
#!/bin/bash
usage() {
cat << EOF
Usage: $0 [OPTION]... COMMAND
Execute the given command in a way that works safely with cron. This should
typically be used inside of a cron job definition like so:
* * * * * $(which "$0") [OPTION]... COMMAND
Arguments: