Skip to content

Instantly share code, notes, and snippets.

View kasuken's full-sized avatar
:octocat:
Authoring courses

Emanuele Bartolesi kasuken

:octocat:
Authoring courses
View GitHub Profile
@kasuken
kasuken / devmachine.ps1
Last active January 27, 2022 10:40
Boxstarter script for a dev machine
#####################
# PREREQUISITES
#####################
Set-ExplorerOptions -showHiddenFilesFoldersDrives -showProtectedOSFiles -showFileExtensions
Set-TaskbarSmall
# Console
cinst PowerShell
cinst poshgit
@kasuken
kasuken / EmptySiteCollectionsRecycleBin.ps1
Last active June 19, 2019 09:49
Powershell script to remove an SPOsite (from the recycle bin, as well)
$username = ""
$password = ""
$Password = ConvertTo-SecureString -String $password -AsPlainText -Force;
$Credentials = new-object -typename System.Management.Automation.PSCredential -argumentlist $username, $password
Connect-SPOService -Url "https://[tenant]-admin.sharepoint.com" -Credential $Credentials
Get-SPODeletedSite | Remove-SPODeletedSite
@kasuken
kasuken / profiles.json
Created June 23, 2019 12:22
Windows Terminal settings and files
{
"globals" :
{
"alwaysShowTabs" : true,
"defaultProfile" : "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
"initialCols" : 120,
"initialRows" : 30,
"keybindings" :
[
{
@kasuken
kasuken / powershellsnippetvscode.json
Created September 25, 2019 06:46
PowerShell snippet for VS Code
{
"Condition statement": {
"prefix": "cond",
"body": [
"${_} { ${0}; break }"
],
"description": "Switch condition statement"
},
"Condition single quoted string statement": {
@kasuken
kasuken / RestartSP.cmd
Created November 15, 2019 09:21
A simple command file to restart all SharePoint 2016 services on the server
@echo off
@echo Stopping Sharepoint services...
@echo Restarting The SharePoint Timer Service...
net stop SPTimerV4
net start SPTimerV4
@echo Restarting The SharePoint Administration Service...
@kasuken
kasuken / 00 - A collection of free DNS Servers
Last active May 24, 2024 10:31
Set and Reset DNS Settings with PowerShell
A collection of my favorites DNS
@kasuken
kasuken / DisableFooter.ps1
Created January 6, 2020 10:18
Disable footer on Office 365 Communication Sites
$orgName = "M365cm599554"
$userCredential = Get-Credential
Connect-SPOService -Url https://$orgName-admin.sharepoint.com -Credential $userCredential
$sites = Get-SPOSite -Template SITEPAGEPUBLISHING#0
foreach ($site in $sites) {
Connect-PnPOnline -Url $site.url -Credentials $userCredential
$web = Get-PnPWeb
$web.FooterEnabled = $false
@kasuken
kasuken / AzureCleaner.ps1
Created January 14, 2020 15:39
An Azure Function PowerShell script to clean all expired resources, all empty resource groups and all expired resource groups
$currentUTCtime = (Get-Date).ToUniversalTime()
$expiredResources = Search-AzGraph -Query 'where todatetime(tags.expireOn) < now() | project id, name'
foreach ($r in $expiredResources) {
Write-Host "==> Deleting $($r.name)...";
Remove-AzResource -ResourceId $r.id -Force -WhatIf
}
$expiredResources = Get-AzResourceGroup;
@kasuken
kasuken / profiles.json
Created January 18, 2020 14:30
Windows Terminal Retrowave Color Scheme
{
"$schema": "https://aka.ms/terminal-profiles-schema",
"defaultProfile": "{7d04ce37-c00f-43ac-ba47-992cb1393216}",
"initialCols": 120,
"initialRows": 30,
"profiles": [
{
"acrylicOpacity": 0.85,
@kasuken
kasuken / VS 2019 and VS Code - Defender Exclusions.ps1
Last active February 12, 2024 03:30
This script adds path exclusions to Windows Defender for VS 2019 and Visual Studio Code processes and folders.
# Remember to run the script "as Administrator"
$pathExclusions = New-Object System.Collections.ArrayList
$processExclusions = New-Object System.Collections.ArrayList
$pathExclusions.Add('C:\Windows\Microsoft.NET') > $null
$pathExclusions.Add('C:\Windows\assembly') > $null
$pathExclusions.Add($env:USERPROFILE + '\AppData\Local\Microsoft\VisualStudio') > $null
$pathExclusions.Add($env:USERPROFILE + '\.nuget\packages') > $null
$pathExclusions.Add('C:\ProgramData\Microsoft\VisualStudio\Packages') > $null