Skip to content

Instantly share code, notes, and snippets.

@macna
macna / apache-powershell-logrotate.ps1
Created January 14, 2019 13:40
A PowerShell script for rotating Apache HTTP Server logs
# Define where Apache writes the log files
$logFiles = "C:\path\to\logs"
# Define the location the log files should be archived to
$logArchive = "C:\path\to\archive"
# Define for how many days we should retain logs in the archive location
$logLimit = (Get-Date).AddDays(-90)
# Stop the Apache HTTP Server service, using a wildcard to find it by name
@macna
macna / openssl-powershell-certgen.ps1
Last active August 14, 2023 04:31
A PowerShell script for generating CSRs using OpenSSL
# Define where OpenSSL is installed
$openSSLDir = "C:\Program Files\OpenSSL\bin"
# Define the domain we're generating the CSR for
$commonName = Read-Host -Prompt "Provide the domain you're generating a certificate for"
# Define the default parameters on the certificate
$email = 'webteam@contoso.com'
$country = 'GB'
$state = 'Suffolk'