This file contains hidden or 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
# 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 |
This file contains hidden or 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
$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 |
This file contains hidden or 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
#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 |
This file contains hidden or 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
<Project> | |
<PropertyGroup> | |
<SrcRoot>$(MSBuildThisFileDirectory)</SrcRoot> | |
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">$(SrcRoot)\</SolutionDir> | |
<Configuration Condition="$(Configuration) == ''">Debug</Configuration> | |
</PropertyGroup> | |
<PropertyGroup> | |
<TargetFramework>net472</TargetFramework> |
This file contains hidden or 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
param ( | |
[string]$URL, | |
[string]$PAT, | |
[string]$POOL, | |
[string]$AGENT | |
) | |
Write-Host "start" | |
if (test-path "c:\agent") |
This file contains hidden or 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
#------------------------------------------------------------------------------------- | |
# 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 ` |
This file contains hidden or 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
# An example to get the remaining rate limit using the Github GraphQL API. | |
import requests | |
headers = {"Authorization": "Bearer YOUR API KEY"} | |
def run_query(query): # A simple function to use requests.post to make the API call. Note the json= section. | |
request = requests.post('https://api.github.com/graphql', json={'query': query}, headers=headers) | |
if request.status_code == 200: |
This file contains hidden or 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
using System; | |
using System.Collections.Immutable; | |
using System.Diagnostics; | |
using System.IO; | |
using System.Linq; | |
using System.Reflection; | |
using System.Reflection.Metadata; | |
using System.Reflection.PortableExecutable; | |
using System.Security.Cryptography; |
This file contains hidden or 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
#Requires -RunAsAdministrator | |
#OneLine | |
if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) { Start-Process powershell.exe "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`"" -Verb RunAs; exit } | |
#Or | |
$Loc = Get-Location | |
"Security.Principal.Windows" | % { IEX "( [ $_`Principal ] [$_`Identity ]::GetCurrent() ).IsInRole( 'Administrator' )" } | ? { | |
$True | % { $Arguments = @('-NoProfile','-ExecutionPolicy Bypass','-NoExit','-File',"`"$($MyInvocation.MyCommand.Path)`"","\`"$Loc\`""); | |
Start-Process -FilePath PowerShell.exe -Verb RunAs -ArgumentList $Arguments; } } |
This file contains hidden or 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
$latestRelease = Invoke-WebRequest https://github.com/pester/Pester/releases/latest -Headers @{"Accept"="application/json"} | |
$json = $latestRelease.Content | ConvertFrom-Json | |
$latestVersion = $json.tag_name | |
$url = "https://github.com/pester/Pester/archive/$latestVersion.zip" | |
$download_path = "$env:USERPROFILE\Downloads\pester-master.zip" | |
Invoke-WebRequest -Uri $url -OutFile $download_path | |
Get-Item $download_path | Unblock-File |
NewerOlder