This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" } |