Skip to content

Instantly share code, notes, and snippets.

View PlagueHO's full-sized avatar
😼
Working on Game Master Copilot using Semantic Kernel, Azure OpenAI and Blazor 8

Daniel Scott-Raynsford PlagueHO

😼
Working on Game Master Copilot using Semantic Kernel, Azure OpenAI and Blazor 8
View GitHub Profile
@PlagueHO
PlagueHO / SSL.tests.ps1
Last active January 26, 2024 16:01
PowerShell Pester Tests for checking SSL endpoints
<#
.DESCRIPTION
Outputs the SSL protocols that the client is able to successfully use to connect to a server.
.PARAMETER ComputerName
The name of the remote computer to connect to.
.PARAMETER Port
The remote port to connect to. The default is 443.
@PlagueHO
PlagueHO / Create-Jenkins-Master-On-Windows-Server-Core.ps1
Last active January 11, 2024 15:44
Create a Jenkins Master on a Windows Server 2012 R2 Core install
# Configure the settings to use to setup this Jenkins Executor
$Port = 80
$IPAddress = '192.168.1.96'
$SubnetPrefixLength = 24
$DNSServers = @('192.168.1.1')
$DefaultGateway = '192.168.1.1'
# Install .NET Framework 3.5
Install-WindowsFeature -Name NET-Framework-Core
@PlagueHO
PlagueHO / split-multifunctionscriptintosinglefunctionfiles.ps1
Created November 2, 2018 07:46
Split a PowerShell Script containing multiple functions into a single function files
. .\utils.ps1
Get-Command *-CosmosDb* |
ForEach-Object {
$filename = Join-Path -Path (Get-Location) -ChildPath "$($_.name).ps1"
"function $($_.Name)`r`n{`r`n$($_.Definition)}" | Set-Content -Path $filename -Force
}
@PlagueHO
PlagueHO / Blog_ISCSIRemoveTargetPortalCorrect.ps1
Created December 26, 2015 22:23
Example: Correctly remove an iSCSI Target Portal
Remove-IscsiTargetPortal -TargetPortalAddress 192.168.129.24 -InitiatorPortalAddress 192.168.129.30
@PlagueHO
PlagueHO / Install-DockerOnWS2016ByDSC.ps1
Last active June 28, 2023 05:21
Install Docker on Windows Server 2016 RTM using DSC
Configuration ContainerHostDsc
{
# Set up general parameters used to determine paths where Docker will
# be installed to and downloaded from.
$ProgramFiles = $ENV:ProgramFiles
$DockerPath = Join-Path -Path $ProgramFiles -ChildPath 'Docker'
$DockerZipFileName = 'docker.zip'
$DockerZipPath = Join-Path -Path $ProgramFiles -ChildPath $DockerZipFilename
$DockerUri = 'https://download.docker.com/components/engine/windows-server/cs-1.12/docker.zip'
@PlagueHO
PlagueHO / NullCoalescingOperatorInPowerShell.ps1
Created August 18, 2019 08:36
Null Coalescing Operator In PowerShell
$notNull = ($x, $y, 1 -ne $null)[0] # Null Coalescing in PowerShell
@PlagueHO
PlagueHO / Export-Certificate.ps1
Created September 10, 2016 11:36
Export a Base-64 x.509 certificate on Windows 7
$certificate = Get-ChildItem -Path Get-ChildItem -path Cert:\CurrentUser\My\D675AE3AE9F7B56348C17EE527F261CFCEA0FD13
$base64certificate = @"
-----BEGIN CERTIFICATE-----
$([Convert]::ToBase64String($certificate.Export('Cert'), [System.Base64FormattingOptions]::InsertLineBreaks)))
-----END CERTIFICATE-----
"@
Set-Content -Path "$ENV:USERPROFILE\Documents\MyCert.cer" -Value $base64certificate
@PlagueHO
PlagueHO / azure-pipelines.yml
Created January 24, 2021 03:52
Example Azure DevOps Multi-Stage YAML Pipeline triggered off malicious branch
trigger:
branches:
include:
- 'main'
- 'malicious-change'
pr: none
stages:
- stage: Build
jobs:
@PlagueHO
PlagueHO / Invoke-AzContainerGroupCommand.ps1
Created October 26, 2020 02:57
Execute a command on an Azure Container Instance and return a terminal
$SubscriptionId = '<subscription id>'
$ResourceGroupName = 'my-container-rg'
$AciName = 'my-container-aci'
$resourceId = "/subscriptions/$($SubscriptionId)/resourceGroups/$($ResourceGroupName)/providers/Microsoft.ContainerInstance/containerGroups/$($AciName)/containers/$($AciName)"
$command = "/zap/zap-baseline.py -t 'https://myapplication.net' -x OWASP-ZAP-Report.xml"
Invoke-AzResourceAction `
-ResourceId $resourceId `
-Action 'exec' `
-ApiVersion '2019-12-01' `
@PlagueHO
PlagueHO / Get-AzLogAnalyticsWorkspaceSource.ps1
Created July 28, 2021 03:40
PowerShell function that looks for Azure resources and services that send data to Log Analytics workspaces. Use this to assess the usage of Azure Log Analytics workspaces across a tenant.
#Requires -Modules @{ ModuleName = 'Az.Accounts'; ModuleVersion = '2.5.1' }
#Requires -Modules @{ ModuleName = 'Az.Resources'; ModuleVersion = '4.2.0' }
#Requires -Modules @{ ModuleName = 'Az.Compute'; ModuleVersion = '4.15.0' }
#Requires -Modules @{ ModuleName = 'Az.OperationalInsights'; ModuleVersion = '2.3.0' }
#Requires -Modules @{ ModuleName = 'Az.Aks'; ModuleVersion = '2.2.0' }
<#
.SYNOPSIS
Returns an array Azure Log Analytics workspaces and the resources
that send data to them.