This file contains 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
# Get the list of installed programs | |
$installedPrograms = Get-ItemProperty HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\* | Select-Object DisplayName | |
$containsSplunk = $installedPrograms.DisplayName -like "*UniversalForwarder*" | |
if ($containsSplunk) { | |
Write-Output "[INFO] Splunk found. Removing" | |
if (Get-Service -Name SplunkForwarder -ErrorAction SilentlyContinue) { | |
Start-Process -FilePath "C:\Program Files\SplunkUniversalForwarder\bin\splunk.exe" -ArgumentList "stop" -Wait -NoNewWindow | |
} | |
$productCode = Get-WmiObject Win32_Product -Filter "name='UniversalForwarder'" | ForEach-Object { $_.IdentifyingNumber } |
This file contains 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 | |
#Requires -PSEdition Desktop | |
Import-Module ps2exe | |
ps2exe .\your-powershell.ps1 your-exe.exe -noconsole -company 'JoeCorp' -product 'AppProductName' -description 'App Description' |
This file contains 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
<# | |
.REQUIREMENTS | |
- Visual Studio 2022 | |
- Wix Toolset 3.x | |
- .NET framework SDKs / core required by app | |
- Nuget | |
- git | |
#> |
This file contains 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
# Required for auth | |
$imdsv2Token = Invoke-RestMethod -Method PUT -Uri "http://169.254.169.254/latest/api/token" -Headers @{"X-aws-ec2-metadata-token-ttl-seconds" = "30"} | |
# Get Instance ID | |
$instanceId = Invoke-RestMethod -Uri "http://169.254.169.254/latest/meta-data/instance-id" -Headers @{"X-aws-ec2-metadata-token" = "$imdsv2Token"} | |
# Get Tag on Current Instance | |
$instanceId = Invoke-RestMethod -Uri "http://169.254.169.254/latest/meta-data/instance-id" -Headers @{"X-aws-ec2-metadata-token" = "$imdsv2Token"} | |
$ec2Tag = (Get-EC2Tag -Filter @{Name = "resource-type"; Values = "instance" }, @{Name = "resource-id"; Values = $instanceId }, @{Name = 'tag:t_something'; Values = "*" }).Value |
This file contains 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( | |
[switch]$dev, | |
[switch]$qa, | |
[switch]$prod | |
) | |
# Define the multidimensional array | |
$apps = @( | |
@{ stack = 'dev'; appName = "foo"; username = 'foo1'; password = "passy1" } | |
@{ stack = 'dev'; appName = "foo-dev1"; username = 'foo1'; password = "passy1" } |
This file contains 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
Import-Module c:\ProgramData\Amazon\EC2-Windows\Launch\Module\Ec2Launch.psm1; Add-Routes |
This file contains 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
<# | |
.DESCRIPTION | |
Generates Gameshark codes for Pokemon Gold/Silver/Crystal to encounter a specific Pokemon at a specific level | |
Takes user input for the Pokemon name and level and generates the codes | |
#> | |
function ConvertTo-Hex { | |
param ( | |
[Parameter(Mandatory=$true)] | |
[int]$Number |
This file contains 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
# This will ping google to test for a WAN connection and reboot if it fails | |
# Workaround to my Windows Sandbox always losing network | |
# The weird logging to write-host/write-output is designed to be used with Windows task scheduler (interactive logon) or via console directly | |
$host.ui.RawUI.WindowTitle = "Network Checker" | |
Clear-Host | |
$dt = (get-date).toString() | |
Write-Host "Network Check Running. Logfile: C:\Users\$($env:username)\networkCheck.log" | |
Write-Output "[$dt] Network Check Running. Logfile: C:\Users\$($env:username)\networkCheck.log" | Out-File -FilePath "C:\Users\$($env:username)\networkCheck.log" -Encoding utf8 -Append |
This file contains 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 ( | |
[Parameter(Mandatory=$true)] | |
[string]$privateKeyFilePath | |
) | |
# Remove inheritance from the private key file to prevent inheriting permissions from parent directories | |
. icacls $privateKeyFilePath /c /t /Inheritance:d | |
# Grant full control to the current user for keys within the user profile directory | |
. icacls $privateKeyFilePath /c /t /Grant ${env:UserName}:F |
This file contains 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
# Modify Hosts file (/jffs/configs/hosts.add) | |
service restart_dnsmasq | |
# Parse Custom Client List | |
nvram get custom_clientlist | sed 's/</\n/g; s/>/\t/g' | sed 's/^/custom\t/' | tail '+2' | sed 's/\(^.*\)\(\t.*\)\(\t[0-9A-F][0-9A-F]:.*$\)/\1\3\2/' | |
# Remove Logged in User restriction | |
nvram unset login_ip | |
nvram commit |
NewerOlder