Skip to content

Instantly share code, notes, and snippets.

View SomeCallMeTom's full-sized avatar

SomeCallMeTom

  • The Pale Blue Dot
View GitHub Profile
@SomeCallMeTom
SomeCallMeTom / ShouldProcessOutput.md
Last active February 3, 2025 23:01 — forked from refactorsaurusrex/process-vs-continue.ps1
PowerShell: What's the difference between ShouldContinue and ShouldProcess?

PSCmdlet.ShouldProcess()

Here is a complete description of the ShouldProcess behavior, with all overrides and both WhatIf and Confirm outputs.

Arg Count Parameters by Position WhatIf Output Confirm Output
1 "TARGET"
What if: Performing the operation "FUNCTION_NAME" on target "TARGET". 
Confirm
Are you sure you want to perform this action?
Performing the operation "FUNCTION_NAME" on target "TARGET".
2 "TARGET",
"OPERATION"
What if: Performing the operation "OPERATION" on target "TARGET". 
Confirm 
Are you sure you want to perform this action?
Performing the operation "OPERATION" on target "TARGET".
3 "MESSAGE", "TARGET", "OPERATION" What if: MESSAGE OPERATION TARGET
@SomeCallMeTom
SomeCallMeTom / Install-7zip.ps1
Last active March 4, 2024 22:25 — forked from dansmith65/Install-7zip.ps1
Install latest version of 7-zip via PowerShell
$dlurl = 'https://7-zip.org/' + (Invoke-WebRequest -UseBasicParsing -Uri 'https://7-zip.org/' | Select-Object -ExpandProperty Links | Where-Object {($_.outerHTML -match 'Download')-and ($_.href -like "a/*") -and ($_.href -like "*-x64.exe")} | Select-Object -First 1 | Select-Object -ExpandProperty href)
# modified to work without IE
# above code from: https://perplexity.nl/windows-powershell/installing-or-updating-7-zip-using-powershell/
$installerPath = Join-Path $env:TEMP (Split-Path $dlurl -Leaf)
Invoke-WebRequest $dlurl -OutFile $installerPath
Start-Process -FilePath $installerPath -Args "/S" -Verb RunAs -Wait
Remove-Item $installerPath
@SomeCallMeTom
SomeCallMeTom / install_mysql_client.sh
Last active September 26, 2024 17:26 — forked from sshymko/install_mysql_client.sh
Install MySQL 8.0 client on Amazon Linux 2
#!/bin/sh
sudo yum install -y https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm
sudo yum install -y mysql-community-client