View file_datetime.ps1
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
$outputFileName = "C:\Temp\File_{0:yyyyMMdd}_{0:HHmmss}.csv" -f (Get-Date) | |
#C:/Temp/File_20230510_115723.csv |
View Update-SessionEnvironment.ps1
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
# Use chocolatey to refresh the path | |
Import-Module "$env:ChocolateyInstall\helpers\chocolateyInstaller.psm1" | |
Update-SessionEnvironment -Full |
View pwshIntellisense.ps1
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
## https://devblogs.microsoft.com/powershell/psreadline-2-2-6-enables-predictive-intellisense-by-default ## | |
# Get Configuration | |
Get-PSReadLineOption | |
## Get Intellisense Option | |
(Get-PSReadLineOption).PredictionSource | |
# Command History Path | |
(Get-PSReadLineOption).HistorySavePath |
View dns-cluster-permissions.ps1
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 a listing of all clusters (CLUS) | |
$clusters = Get-ADComputer -Filter "Name -like 'CLUS'" | |
#Set Domain | |
$DNSServer = (Get-ADDomain).PDCEMulator | |
#Set DNS Zone | |
$DNSZone = "dev.contoso.com" | |
#Iterate through the list of clusters get dns and add the appropriate full control objects (listener, cluster) |
View iisHeaders.ps1
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
Import-Module WebAdministration | |
# Add Custom Header - Server Level | |
Add-WebConfigurationProperty -PSPath MACHINE/WEBROOT/APPHOST ` | |
-Name . -Filter system.webServer/httpProtocol/customHeaders ` | |
-AtElement @{name = "X-Custom" ; value = 'value' } | |
#Remove Server: Microsoft-IIS/10.0 Header | |
Set-WebConfigurationProperty -pspath 'MACHINE/WEBROOT/APPHOST' -filter "system.webServer/security/requestFiltering" -name "removeServerHeader" -value "True" |
View wsl_helper.ps1
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
#Check WSL Version | |
wsl -l -v | |
#Set WSL Version to 2 | |
wsl --set-version Ubuntu-22.04 2 |
View su-gitlab-runner.sh
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
sudo su -l gitlab-runner -s /bin/bash |
View retry.sh
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
Begin { | |
$retryCount = 0 | |
$retryMax = 5 | |
$retryPauseSeconds = 30 | |
} | |
Process { | |
do { | |
$retryCount++ | |
try { |
View ubuntu_cleanup.sh
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
sudo apt autoremove --purge | |
# Remove logs | |
sudo -s | |
sudo rm -rf /var/log/*.gz | |
sudo rm -rf /var/log/apt/*.gz && sudo rm -rf /var/log/apt/*.xz | |
sudo rm -rf /var/log/installer/*.gz |
NewerOlder