Powershell – Getting Formatted Date Info

This is a simple one, want to get today, yesterday, last month or last year .. try this $Date = Get-Date $Today = $Date | Get-date -Format MM/dd/yyyy $Yesterday = $Date.AddDays(-1) | Get-Date -Format MM/dd/yyyy $LastMonth = $Date.AddMonths(-1) | Get-date -Format MM/dd/yyyy $LastYear = $Date.AddYears(-1) | Get-Date -Format MM/dd/yyyy You… Continue reading

Quick Powershell ShortCut

Shortcut If you are using the where command Get-Mailbox * | Where-Object {$_.EmailAddress -like “*something.com”} you can use a question mark Get-Mailbox * | ? {$_.EmailAddress -like “*something.com”} Some others I often use: Format-List = FL Format-Table = FT Get-Item = gi Export-CSV = epcsv Import-PSSession = ipsn Add-PsSnapIn =… Continue reading

LetsEncrypt – Errors

The other day I went to update my certificates and was receiving an error running the letsencrypt script to update. The error was Error: couldn’t get currently installed version for /root/.local/share/letsencrypt/bin/letsencrypt: An unexpected error occurred: VersionConflict: (certbot 0.11.1 (/root/.local/share/letsencrypt/lib/python2.7/site-packages), Or something along that lines. After trying to remember what I… Continue reading