Skip to content

Instantly share code, notes, and snippets.

@mdgrs-mei
mdgrs-mei / TerminalSpinner.ps1
Created June 15, 2023 14:43
Show spinner on the Windows Terminal tabs for every command.
$global:originalPSConsoleHostReadLine = $function:global:PSConsoleHostReadLine
$global:originalPrompt = $function:global:Prompt
$function:global:PSConsoleHostReadLine = {
$startProgressIndicator = "`e]9;4;3;50`e\"
$command = $originalPSConsoleHostReadLine.Invoke()
$startProgressIndicator | Write-Host -NoNewLine
$command
}
@PierrickBIT
PierrickBIT / gist:953091bb420277a73a1d7b583e268fe3
Created January 31, 2023 07:36
[MS TEAMS] Copier les fichiers d'une conversation vers une bibliothèque SharePoint 365
# Charger les bibliothèques requises
Install-Module Microsoft.Graph.Teams -Force
Install-Module Microsoft.Graph.SharePoint -Force
# Définir les informations d'identification de l'application
$clientId = "<Application ID>"
$clientSecret = "<Application Secret>"
$tenantId = "<Tenant ID>"
# Obtenir un jeton d'accès
@FriedrichWeinmann
FriedrichWeinmann / DomainCryptographyScan.ps1
Last active May 30, 2023 05:15
Scans an Active Directory domain's and its principal's kerberos encryption configuration.
<#
.SYNOPSIS
Scans an Active Directory domain's and its principal's kerberos encryption configuration.
.DESCRIPTION
Scans an Active Directory domain's and its principal's kerberos encryption configuration.
It will generate all data via LDAP, and analyze the results for possible authentication issues.
It supports three ways to report:
- Print: Write analysis of results to screen
@adamdriscoll
adamdriscoll / dashboard.ps1
Created November 29, 2022 09:27
People Picker for PowerShell Universal
function Get-User {
1..100 | ForEach-Object {
[PSCustomObject]@{
UserName = "User$_"
First = "Bill"
Last = $_
Avatar = (Get-ChildItem "$Repository\Avatars" | Get-Random).Name
}
}
}
# Convert-ADName.ps1
# Written by Bill Stewart (bstewart@iname.com)
# PowerShell wrapper script for the NameTranslate COM object.
#requires -version 2
<#
.SYNOPSIS
Translates Active Directory names between various formats.
@defensivedepth
defensivedepth / osquery-compromised-mega-chrome-ext.sql
Last active March 30, 2024 12:47
osquery query to find systems that have the compromised Mega Chrome Extension installed
-- Joins chrome_extension and users table, looks for Mega chrome identifier and specific version number; should also consider running without the version number, to find all users with Mega extension installed and then get it removed prior to it updating.
SELECT users.username,chrome_extensions.name,chrome_extensions.version,chrome_extensions.path FROM chrome_extensions JOIN users ON users.uid = chrome_extensions.uid where chrome_extensions.identifier = 'bigefpfhnfcobdlfbedofhhaibnlghod' and chrome_extensions.version = '3.39.4';
@mackwage
mackwage / windows_hardening.cmd
Last active April 28, 2024 20:54
Script to perform some hardening of Windows OS
:: Windows 10 Hardening Script
:: This is based mostly on my own personal research and testing. My objective is to secure/harden Windows 10 as much as possible while not impacting usability at all. (Think being able to run on this computer's of family members so secure them but not increase the chances of them having to call you to troubleshoot something related to it later on). References for virtually all settings can be found at the bottom. Just before the references section, you will always find several security settings commented out as they could lead to compatibility issues in common consumer setups but they're worth considering.
:: Obligatory 'views are my own'. :)
:: Thank you @jaredhaight for the Win Firewall config recommendations!
:: Thank you @ricardojba for the DLL Safe Order Search reg key!
:: Thank you @jessicaknotts for the help on testing Exploit Guard configs and checking privacy settings!
:: Best script I've found for Debloating Windows 10: https://github.com/Sycnex/Windows10Debloater
:
@daviwil
daviwil / VSCodeDeepDive.md
Created April 13, 2017 13:38
The notes from my session "Authoring in VS Code" at the 2017 PowerShell and DevOps Global Summit in Bellevue, WA.

Visual Studio Code Deep Dive

David Wilson - @daviwil Software Engineer, PowerShell Team

Overview

  1. Visual Studio Code overview
  2. Configuring the editor
  3. Extensions
@jdhitsolutions
jdhitsolutions / Test-UpOrDown.ps1
Last active November 13, 2020 18:05
A PowerShell function that uses the web site DownForEveryoneOrJustme.com to test is a web site or domain is up or down
#requires -version 4.0
Function Test-UporDown {
<#
.Synopsis
Test if a web site is down or if it is just you.
.Description
The function uses the web site DownForEveryoneOrJustme.com to test is a web site or domain is up or down, or if the problem is just you. The command will write a custom object to the pipeline. See examples.
<#
.SYNOPSIS
Sets the system fields for a specific list/library item.
.DESCRIPTION
This will set the system fields (created, created by, modified, modified by)
for a specific list/library item.
Provide any or all of those system fields as a parameter and they will be set.
If no modified date is provided, the item keeps its current modified date.