Skip to content

Instantly share code, notes, and snippets.

# Define the path where you want to save the CSV file
$exportPath = "C:\temp\ExportLogs.csv"
# Get the current date and subtract 3 days
$startDate = (Get-Date).AddDays(-3)
# Define the log names
$applicationLog = "Application"
$systemLog = "System"
@kfparri
kfparri / PowerShellWindowsUpdates.ps1
Created July 22, 2023 17:03
Powershell script to install PSWindowsUpdate and install all available updates.
# Make sure the execution policy is set to All Signed
Set-ExecutionPolicy -ExecutionPolicy AllSigned
Write-Output "Checking to see if the Windows Update cmdlets are installed"
Install-Module PSWindowsUpdate -Confirm
Write-Output "Installing Windows Updates"
Get-WindowsUpdate -AcceptAll -Install -AutoReboot
@kfparri
kfparri / ips.txt
Created April 9, 2021 16:18
Query list of Cisco devices via SNMP
192.168.1.254
192.168.1.253
:: Don't echo all the text to the command window
@echo off
:: Create a copy from D:\ImportantStuff\Pictures directory to the local directory HomeBackups\Pictures
:: Robocopy's /mir switch will only copy files if they change or don't exists in the destination directory
robocopy D:\ImportantStuff\Pictures HomeBackups\Pictures /mir
:: Copy D:\Music to HomeBackups\Music
robocopy D:\Music HomeBackups\Music /mir