Skip to content

Instantly share code, notes, and snippets.

@RomelSan
RomelSan / Powershell-Certificates-BRIEF.ps1
Last active May 2, 2024 02:43
Powershell Self Signed Certificate
#-------------------------------------------------------------------------------------
# Create Self signed root certificate
# -dnsname -DnsName domain.example.com,anothersubdomain.example.com
# -Subject "CN=Patti Fuller,OU=UserAccounts,DC=corp,DC=contoso,DC=com"
$cert = New-SelfSignedCertificate -Type Custom -KeySpec Signature `
-Subject "CN=P2SRootCert" `
-KeyExportPolicy Exportable `
-HashAlgorithm sha256 -KeyLength 4096 `
-CertStoreLocation "Cert:\CurrentUser\My" `
-KeyUsageProperty Sign `
@MaxMelcher
MaxMelcher / devops_win.ps1
Last active February 20, 2024 07:02
Powershell to install the latest Azure DevOps Agent
param (
[string]$URL,
[string]$PAT,
[string]$POOL,
[string]$AGENT
)
Write-Host "start"
if (test-path "c:\agent")
@KirillOsenkov
KirillOsenkov / Directory.Build.props
Created April 12, 2019 16:56
SDK-style Directory.Build.props for common output directory
<Project>
<PropertyGroup>
<SrcRoot>$(MSBuildThisFileDirectory)</SrcRoot>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">$(SrcRoot)\</SolutionDir>
<Configuration Condition="$(Configuration) == ''">Debug</Configuration>
</PropertyGroup>
<PropertyGroup>
<TargetFramework>net472</TargetFramework>
@brianvanderlugt
brianvanderlugt / PreRequisites.ps1
Last active April 12, 2025 20:53
PowerShell script to output graph dependency to help resolve nuget dependencies.
#Requires -RunAsAdministrator
# Pre-requisites
Install-Module PowerShellGet -Force # to install additional packages
Import-Module PowerShellGet -MinimumVersion 2.2.0
# Doesn't work because PowerShellGet doesn't support SemVer 2.0 yet. https://github.com/PowerShell/PowerShellGet/issues/222
Install-Package NuGet.Core,NuGet.ProjectModel
# Instead run. Recommmend copy as installs additional libraries already cover by NETStandard 2.0
@lukejjh
lukejjh / ToggleDarkMode.ps1
Created August 22, 2021 00:08
PowerShell script that toggles dark mode in Windows 10/11, for both apps and system.
$k = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize"
$v = (Get-ItemProperty -Path $k).SystemUsesLightTheme -bxor 1
Set-ItemProperty -Path $k -Name "SystemUsesLightTheme" -Value $v
Set-ItemProperty -Path $k -Name "AppsUseLightTheme" -Value $v
@jborean93
jborean93 / Trace-TlsHandshake.ps1
Last active December 7, 2023 14:49
Debug TLS Handshakes using .NET
# Copyright: (c) 2022, Jordan Borean (@jborean93) <[email protected]>
# MIT License (see LICENSE or https://opensource.org/licenses/MIT)
Function Trace-TlsHandshake {
<#
.SYNOPSIS
TLS Handshake Diagnostics.
.DESCRIPTION
Performs a TLS handshake and returns diagnostic information about that