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
# 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 = '[email protected]' | |
$country = 'GB' | |
$state = 'Suffolk' |
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
# 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 |
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
Get-ADGroupMember -Identity "Some Group" -Recursive | Get-ADUser -Properties * | Export-Csv -Path "C:\Temp\groupdump.csv" -NoTypeInformation |
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
# Get the server name | |
$hostName = hostname | |
# Define the email address to send notifications to | |
$toAddress = "[email protected]" | |
# Send the notification | |
Send-MailMessage -To $toAddress -From "[email protected]" -SmtpServer smtp.contoso.com -Subject "$hostName - Server Reboot" -Body "The server $hostName has rebooted." |
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
$cert = @(gci cert:\currentuser\my | |
-codesigning)[0] | |
Set-AuthenticodeSignature myscript.ps1 $cert |
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
$webclient=New-Object System.Net.WebClient | |
$creds=Get-Credential | |
$webclient.Proxy.Credentials=$creds | |
$cred = Get-Credential | |
Add-AzureAccount -Credential $cred |
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
$hostname = hostname | |
Send-MailMessage -To [email protected] -From "[email protected]" -Priority High -SmtpServer smtp.contoso.com -Subject "$hostname - Backup Failure" -Body "A backup on $hostname has failed." |
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
display_errors=On | |
log_errors=On | |
error_log = "D:\home\site\wwwroot\<your_dir>\php-errors.log" |
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
forfiles.exe -p C:\<your>\<folder> -m *.txt -d -30 -c "cmd.exe /C del @path"" |
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
mysqldump <dbname> -uroot --skip-triggers > "D:\<your>\<folder>\<dbname>%time:~0,2%%time:~3,2%%time:~6,2%_%date:~-10,2%%date:~-7,2%%date:~-4,4%.sql" |
NewerOlder