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
# Variables | |
$taskName = "UpdateAppPoolRecycleTimes" | |
$taskDescription = "Update IIS App Pool recycling times based on day of the week." | |
$scriptPath = "C:\Scripts\UpdateRecycleTimes.ps1" # Full path to your PowerShell script | |
$user = "NT AUTHORITY\SYSTEM" # User account under which the task will run | |
$taskRunTime = "01:00" # Time to run the task daily | |
# Create a daily trigger for the task at a specified time | |
$trigger = New-ScheduledTaskTrigger -Daily -At $taskRunTime |
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 the appropriate base image | |
FROM mcr.microsoft.com/windows/servercore:ltsc2019 | |
# Copy the PowerShell script to the container | |
COPY set-recycle-times.ps1 /set-recycle-times.ps1 | |
# Run the PowerShell script to set the recycle times | |
RUN powershell -ExecutionPolicy Bypass -File /set-recycle-times.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
# Define the app pool name | |
$appPoolName = "DefaultAppPool" | |
# Clear existing schedule | |
Clear-WebConfiguration "/system.applicationHost/applicationPools/add[@name='$appPoolName']/recycling/periodicRestart/schedule" | |
# Add recycling times directly using WebConfiguration | |
Add-WebConfigurationProperty -pspath "MACHINE/WEBROOT/APPHOST" ` | |
-filter "system.applicationHost/applicationPools/add[@name='$appPoolName']/recycling/periodicRestart/schedule" ` | |
-name "." -value @{ value = "02:00:00" } |
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
RUN Import-Module WebAdministration; ` | |
Set-ItemProperty "IIS:\AppPools\DefaultAppPool" -Name Recycling.periodicRestart.time -Value 0.00:00:00; ` | |
Set-ItemProperty "IIS:\AppPools\DefaultAppPool" -Name Recycling.periodicRestart.requests -Value 0; |
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
Cordon all nodes: | |
kubectl get nodes | ForEach-Object{($_.Split(""))[0]} | where {$_ -ne " NAME"} | ForEach-Object{(kubectl cordon $_)} | |
Rollout Master node: | |
kubectl get deployments -n kube-system| ForEach-Object{($_.Split(""))[0]} | where {$_ -ne " NAME"} | ForEach-Object{(kubectl -n kube-system rollout restart deployment $_)} | |
kubectl get daemonsets -n kube-system| ForEach-Object{($_.Split(""))[0]} | where {$_ -ne " NAME"} | ForEach-Object{(kubectl -n kube-system rollout restart daemonset $_)} | |
Rollout Worker nodes: | |
kubectl get deployments | ForEach-Object{($_.Split(""))[0]} | where {$_ -ne " NAME"} | ForEach-Object{(kubectl rollout restart deployment $_)} | |
kubectl get daemonsets | ForEach-Object{($_.Split(""))[0]} | where {$_ -ne " NAME"} | ForEach-Object{(kubectl rollout restart daemonset $_)} |
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
pipeline { | |
agent any | |
stages{ | |
stage('Logging into AWS ECR'){ | |
steps{ | |
bat 'aws eks --region us-east-1 update-kubeconfig --name eks-cluster-name' | |
bat 'aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin xxxxxxxxxxx.xxx.ecr.us-east-1.amazonaws.com' | |
} | |
} |
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-Function Get-AllSxaSite | |
$sites = New-Object System.Collections.ArrayList | |
class ItemDetail { | |
[string]$ID | |
[string]$Name | |
[string]$Path | |
[bool]$Cacheable | |
[bool]$ClearOnIndexUpdate |
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-ChildItem Cert:\LocalMachine\My\ | |
Get-ChildItem Cert:\LocalMachine\My\ | Select-Object NotAfter, Subject |
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
public static T GetValueFromSiteSettings<T>(IMvcContext mvcSiteContext, string TenantSiteSettingsTemplateId) | |
{ | |
var query = "/sitecore/content//*[@@ID='" + mvcSiteContext.GetRootItem<Item>().ID + "']/*[@@templateId='" + TenantSiteSettingsTemplateId + "']"; | |
var settings = mvcSiteContext.SitecoreService.Database.SelectSingleItem(query); | |
if (settings == null) | |
{ | |
return null; | |
} | |
return mvcSiteContext.SitecoreService.GetItem<T>(settings); | |
} |
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
<index id="Coveo_pub_index" type="Coveo.SearchProvider.ProviderIndex, Coveo.SearchProvider" patch:before = "*[3]"> | |
<param desc="p_Name">$(id)</param> | |
<configuration ref="coveo/defaultIndexConfiguration" /> | |
<locations hint="list:AddCrawler"> | |
<crawler name="ContentCrawler" type="Sitecore.ContentSearch.SitecoreItemCrawler, Sitecore.ContentSearch"> | |
<database>pub</database> | |
<root>/sitecore/content</root> | |
<stopOnError>true</stopOnError> | |
</crawler> | |
<crawler name="MediaLibraryCrawler" type="Sitecore.ContentSearch.SitecoreItemCrawler, Sitecore.ContentSearch"> |
NewerOlder