Skip to content

Instantly share code, notes, and snippets.

View craeckor's full-sized avatar
💭
i'm thinking

craeckor craeckor

💭
i'm thinking
View GitHub Profile
@craeckor
craeckor / Add-WinGet-Package-Function.ps1
Created November 25, 2024 14:37
Install WinGet-Packages over PackageID with proper error handling
function Add-WinGet-Package {
param(
[Parameter(Position=0)]
[string]$PackageID
)
if (-not $PackageID) {
Write-Host "Please provide a package ID"
return
}
@craeckor
craeckor / Install-AppxProvisionedPackage-Function.ps1
Last active November 25, 2024 14:35
Installs AppxPackages from a specific path with proper error handling.
function Install-AppxProvisionedPackage {
param(
[Parameter(Position=0)]
[string]$PackagePath
)
if (-not $PackagePath) {
Write-Host "Please provide a package path"
return
}
@craeckor
craeckor / Get-CurlDownload-Function.ps1
Last active November 25, 2024 14:35
Downloads file from the internet to a specific path with proper error handling.
function Get-CurlDownload {
param(
[Parameter(Position=0)]
[string]$URL,
[Parameter(Position=1)]
[string]$OutFile
)
if (-not $URL) {
Write-Host "Please provide a URL"
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 }
Write-Host "Microsoft Store Installer"
Write-Host "Select, if you want to install only the Microsoft Store or the Microsoft Store and all requirements."
Write-Host "Warning: Only select the option 1 if you are sure that all requirements are already installed or if you using one of my images."
Write-Host "1. Install only the Microsoft Store"
Write-Host "2. Install the Microsoft Store and all requirements"
$selection = Read-Host "Select an option: "
if ($selection -eq "1") {
$InstallAllRequirements = $false
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 }
Write-Host "Xbox Installer"
Write-Host "Select, if you want to install all requirements or only the Xbox dependencies."
Write-Host "Warning: Only select the option 1 if you are sure that all requirements are already installed or if you using one of my images."
Write-Host "1. Install only Xbox dependencies (This will install the Microsoft Store, cause it is required for Login)"
Write-Host "2. Install all requirements and Xbox dependencies (This will also install the Microsoft Store, cause it is required for Login)"
$selection = Read-Host "Select an option: "
if ($selection -eq "1") {
$InstallAllRequirements = $false
@craeckor
craeckor / Get-AppxPackage-DownloadLinks-Function.ps1
Last active November 25, 2024 14:34
Supports all parameters of https://store.rg-adguard.net/, only one parameter is allowed ($Ring doesn't count), supports proper error handling.
@craeckor
craeckor / script.zip.base64.cmd
Last active February 12, 2025 18:27
Fixes Error 0x80070643 for Windows Update KB5034441
@echo off
SETLOCAL EnableDelayedExpansion
for /f "tokens=* delims=" %%i in ('powershell -command "(Get-WmiObject -Class Win32_OperatingSystem).SystemDrive"') do set drive=%%i
for %%I in ("%~dp0") do set "cdrive=%%~dI"
if not "%cdrive%"=="%drive%" (
copy "%~f0" "%PUBLIC%\%~nx0"
start /b /wait "" cmd.exe /c "%PUBLIC%\%~nx0"
start /b "" cmd.exe /c "%cdrive% && del /f /q "%~f0""
exit /b
)
@craeckor
craeckor / update-cloudflare-dns-records.sh
Last active September 12, 2024 17:30
Script for updating your Cloudflare DNS-Records.
#!/bin/bash
#
# Cloudflare DNS-Records updater script V1.4
# Made by craeckor
#
# This script updates your Cloudflare DNS-Records.
# Requirements: bash, jq, curl and awk.
# API-Token (Not API-Key) is required.
# Only works for one specific Second Level Domain per script. (E.g example.com) Multiple subdomains are supported.
@craeckor
craeckor / aria2c.exe.ps1
Created January 8, 2024 11:19
PowerShell-Script which extracts aria2c from itself into the TEMP-directory and gives out the full-path from the executable aria2c.exe-file.
This file has been truncated, but you can view the full file.
$s = "UEsDBBQAAAAIALdib1cXtIMiCPYjAAA0VgAKAAAAYXJpYTJjLmV4ZeRbeVhUVRR/A4xOKg5ZFC3mZFNJi2GBQbYwwtCbfBglEJYaphKWIcmMoZlpM1O9XlNUtm9WtllmmSGQC4SBlpZpi0uLmdmbJgtbXIPpd+59M/NmmLb/+r74ct5dznbPOffcc5cKr6wTEgVBSMK/YFAQGgT+lyv8/d8c/Os7oKmvsPSw9Sc2GKT1JxZXTq6xVE+beu208TdYJoyvqprqtFwzyTLNVWWZXGXJv3SU5YapEycNTk7uZdVoFNkFYeLtvaLodgiDE3onJJwiXFkgCBmlgnA+2o5ERwoXzSBo5QTIreEYUWF/G0pZo/RSKcZVDlALGjm8vsA/sUWqlArzztLVMy4Vls9JiNTLS4Ux4/9cJ9unS8KgOO13H1cqvN7rz/EGOyfVOmnsZQVcIIydD07HGv8NnjjeSeznzMRPNWBm4TuuQA9GtmsePI0DWnJMIIr+8/Dd2g0ud3A1h8MY2ViF2/A9Et9YuFoON79nEqhfJggmfB/CNxbumpoaKjcPI1uUxPcbkm8ypwddk87BG9+nSrqPI+/yYipXsgbAkSk+iAPnnFITtmURhwP/OHqZNGXqBIHbsBxw1+C7sRvccOF/8tdaUTHYPMDDyuYBuYLo/mGQqBi9iyVhyNp2gaYaqrejGq7I+oqkr5y1SBIq5mYXXukyixOKzhcNG+Zm0wR3TkZnP0DKyY+sKhEUwdvsKmgkJDWpJktQl83KAnpqymuSoPSTU9SHeX3DIq1+7uWZRN5SKwnubINz1JBm0b16UCvJ25hAVFZOyxICDVQ3LytKq5h7sLfBaadPgsvrbvBQnDLfXhsMBpW6/YKAkXk3mh9s8VegxTwA7gjpfclvgIt69+hMIUw+XxDctU6gXgDAfGWOynDt3mZCTkdbRR30lQ3R3oWoks/YtrIElFLb2Sd5DT6KIBufYFXjg/SR860WwKcCPl8xqakQvA7csls1OWwltu
@craeckor
craeckor / connect-sql.ps1
Created October 25, 2023 19:36
Connect PowerShell script with MSSQL-Server
#--------------------------------------------------------------------------------------------------------------
#-- Script to run query and get recordset
#-- Credits: SomTripathi --> https://gist.github.com/SomTripathi/651fd287250ad013720f
#--------------------------------------------------------------------------------------------------------------
function Run-Query( [string]$InstanceName , [string]$DatabaseName, [string]$Query, [string]$Username, [string]$Password)
{
$SQLInstance = $InstanceName
$DBName = $DatabaseName