Skip to content

Instantly share code, notes, and snippets.

View jwmoss's full-sized avatar
🤩
Stuck in a foreach loop

Jonathan Moss jwmoss

🤩
Stuck in a foreach loop
View GitHub Profile
@jwmoss
jwmoss / Set-WindowState.ps1
Last active October 8, 2025 22:14 — forked from lalibi/Set-WindowState.ps1
Hide, Show, Minimize, Maximize, etc window from Powershell.
function Set-WindowState {
<#
.SYNOPSIS
Set the state of a window.
.DESCRIPTION
Set the state of a window using the `ShowWindowAsync` function from `user32.dll`.
.PARAMETER InputObject
The process object(s) to set the state of. Can be piped from `Get-Process`.
@jwmoss
jwmoss / setupiisforsslperfectforwardsecrecy_v17.ps1
Created November 15, 2021 19:05 — forked from jbratu/setupiisforsslperfectforwardsecrecy_v17.ps1
Great powershell script for tightening HTTPS security on IIS and disabling insecure protocols and ciphers. Very useful on core installations.
# Copyright 2019, Alexander Hass
# https://www.hass.de/content/setup-microsoft-windows-or-iis-ssl-perfect-forward-secrecy-and-tls-12
#
# After running this script the computer only supports:
# - TLS 1.2
#
# Version 3.0.1, see CHANGELOG.txt for changes.
Write-Host 'Configuring IIS with SSL/TLS Deployment Best Practices...'
Write-Host '--------------------------------------------------------------------------------'
@jwmoss
jwmoss / setup.sh
Last active April 9, 2021 19:58 — forked from brettmillerb/setup.sh
New Mac Setup
# Check for Homebrew,
# Install if we don't have it
if test ! $(which brew); then
echo "Installing homebrew..."
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
fi
# Update homebrew recipes
echo "Updating homebrew..."
brew update
[CmdletBinding()]
param(
[Parameter( Mandatory, Position = 1, ValueFromPipelineByPropertyName, ValueFromPipeline )]
[Alias( 'HostName', 'Server' )]
[string[]]
$ComputerName,
[System.DirectoryServices.ActiveDirectory.SyncFromAllServersOptions]
$SyncOptions = @( 'CrossSite', 'PushChangeOutward', 'SkipInitialCheck' ),
@jwmoss
jwmoss / Jenkinsfile
Created November 10, 2020 02:38 — forked from merikan/Jenkinsfile
Some Jenkinsfile examples
Some Jenkinsfile examples
@jwmoss
jwmoss / Get-HTMLTable.ps1
Created September 18, 2020 06:59 — forked from JustinGrote/Get-HTMLTable.ps1
Get-HTMLTable Prototype
using namespace HtmlAgilityPack
function Get-HTMLTable {
[CmdletBinding()]
param(
[Parameter(Mandatory,ValueFromPipeline)][HtmlNode]$HtmlDocument
)
process {
foreach ($table in $HtmlDocument.SelectNodes('//table')) {
@jwmoss
jwmoss / StandardDeviation.ps1
Created August 1, 2020 03:07 — forked from powercode/StandardDeviation.ps1
Calculate Standard Deviation is PowerShell
using namespace System.Collections.Generic
using namespace System.Linq
class StandardDeviation{
hidden [decimal] $Average
StandardDeviation([decimal] $average){
$this.Average = $average
}
enum UserRight {
SeAssignPrimaryTokenPrivilege # Replace a process level token
SeAuditPrivilege # Generate security audits
SeBackupPrivilege # Back up files and directories
SeBatchLogonRight # Log on as a batch job
SeChangeNotifyPrivilege # Bypass traverse checking
SeCreateGlobalPrivilege # Create global objects
SeCreatePagefilePrivilege # Create a pagefile
SeCreatePermanentPrivilege # Create permanent shared objects
SeCreateSymbolicLinkPrivilege # Create symbolic links
function Get-InstalledSoftware {
<#
.SYNOPSIS
Get all installed from the Uninstall keys in the registry.
.DESCRIPTION
Read a list of installed software from each Uninstall key.
This function provides an alternative to using Win32_Product.
.EXAMPLE
Get-InstalledSoftware
@jwmoss
jwmoss / Uninstall-Pester.ps1
Created April 17, 2019 15:38 — forked from nohwnd/Uninstall-Pester.ps1
Remove built-in version of Pester on Windows 10, and all other versions of Pester
#Requires -RunAsAdministrator
$modulePath = "C:\Program Files\WindowsPowerShell\Modules\Pester"
if (-not (Test-Path $modulePath)) {
"There is no Pester folder in $modulePath, doing nothing."
break
}
takeown /F $modulePath /A /R
icacls $modulePath /reset