Power Cobra Power shell Mod!
This is a mod for powershell installed by running the installer it adds new commands to powershell and the way it works is the code is added to power shell and powershell recognizes it as actual commands and no script except the installer needs to be ran as after install it works in powershell right away you can see what the new commands are and how they work by typing the new command in powershell "Command-Help" just run the installer and you can integrate it into powershell and you can also uninstall it at any time.(ALSO NOTE HAVING ONE DRIVE ENABLED OR RESTRICTED EXECUTION POLICIES ON YOUR SYSTEM MIGHT BREAK THE INSTALL IF THE COMMANDS DONT WORK TYPE IN POWERSHELL "Set-ExecutionPolicy" OR DISABLE ONE DRIVE UNTIL IT IS INSTALLED)
Below is the open source code of the mod and its installer in case you want to rebuild the installer or mod for yourself this code can be used to make your own version of the mod just credit us for the original code :) also use a different name if you publish your version of the mod.
github link: https://github.com/barteggbert-cloud/Power-Cobra
irm "sha256:e5ee517b5ff1ea40474e219f314b1861ea735892999f2335d53866049a5c3865" | iex
# Custom Module: Integrated PowerShell & Batch Wrappers
# Compatible with PS2EXE and standard .psm1 usage
$CustomCommands = @'
function Get-PrivateIP {
ipconfig | Select-String "IPv4 Address"
[console]::Beep(1000, 500)
}
function Get-PublicIP {
Invoke-RestMethod -Uri "https://api.ipify.org"
[console]::Beep(1000, 500)
}
function Debloat-System {
Write-Host "Starting Bloatware Removal..." -ForegroundColor Yellow
$Apps = @("*bing*", "*windowsmaps*", "*getstarted*", "*yourphone*", "*Copilot*")
foreach ($App in $Apps) {
Write-Host "Removing $App..."
Get-AppxPackage $App -AllUsers | Remove-AppxPackage -ErrorAction SilentlyContinue
}
[console]::Beep(1000, 500)
}
function File-Host {
$fileContent = Read-Host -Prompt "enter the text you want added to a text file"
$filePath = Read-Host -Prompt "enter the full path (e.g. C:\temp\test.txt)"
Set-Content -Path $filePath -Value $fileContent -ErrorAction Stop
Write-Host "your text is being written to a file"
[console]::Beep(1000, 500)
}
function Clear-Temp-And-DNS-Cache {
Clear-DnsClientCache
Remove-Item "$env:TEMP\*" -Recurse -Force -ErrorAction SilentlyContinue
Remove-Item "C:\Windows\Temp\*" -Recurse -Force -ErrorAction SilentlyContinue
Write-Host "your temp files have been deleted to save disk and your dns cache was flushed"
[console]::Beep(1000, 500)
}
function Command-Help {
[console]::Beep(1000, 500)
Write-Host "Always check our website at www.scriptcobra.com for updates and bugfixes"
Write-Host "--- Standard Commands ---" -ForegroundColor White
Write-Host "Get-PrivateIP (shows you your private ip)" -ForegroundColor Green
Write-Host "Get-PublicIP (shows you your public ip)" -ForegroundColor Cyan
Write-Host "Debloat-System (debloats system)" -ForegroundColor Yellow
Write-Host "File-Host (Writes a specified text to a text file)" -ForegroundColor DarkMagenta
Write-Host "Clear-Temp-And-DNS-Cache (clears your temp and dns cache)" -ForegroundColor Blue
Write-Host "Test-Graphics (WARNING if you have epilepsy dont try this!)"
Write-Host "Test-Sound (plays 5 beeps to test speakers)"
Write-Host "`n--- Python Tools ---" -ForegroundColor White
Write-Host "Python-Get-Date-And-Time (needs python)"
Write-Host "Get-Python-As-A-Package (installs python)"
Write-Host "Remove-Python-From-Your-Machine"
Write-Host "Create-A-Json-File-Here"
Write-Host "`n--- System & Maintenance ---" -ForegroundColor White
Write-Host "Start-Powershell-With-Elevated-Privleges"
Write-Host "Emergency-Restart / Emergency-Shutdown"
Write-Host "Import-BatchStuff (Adds extra CMD tools to this session from legacy batch not supported by powershell)" -ForegroundColor Cyan
Write-Host "Install-BatchStuff (Permanently installs to Profile)" -ForegroundColor Green
[console]::Beep(1000, 500)
}
function Python-Get-Date-And-Time {
[console]::Beep(1000, 500)
python -c "import datetime; print(f'Fetching moon phase for {datetime.datetime.now()}...')"
}
function Get-Python-As-A-Package {
[console]::Beep(1000, 500)
Get-AppxPackage Name- *python*
}
function Start-Powershell-With-Elevated-Privleges {
[console]::Beep(1000, 500)
Start-Process powershell -Verb RunAs
}
function Remove-Python-From-Your-Machine {
[console]::Beep(1000, 500)
Get-AppxPackage Name- *python* | Remove-AppxPackage
}
function Create-A-Json-File-Here {
process {
[console]::Beep(1000, 500)
& python -c "import json, sys; data=json.loads(sys.stdin.read()); print(json.dumps(data, indent=4))"
}
}
function Test-Graphics {
Write-Host "starting the graphics test please wait"
$colors = [Enum]::GetValues([System.ConsoleColor])
foreach ($color in $colors) {
$Host.UI.RawUI.BackgroundColor = $color
Clear-Host
Write-Host "testing color: $color" -ForegroundColor White
Start-Sleep -Milliseconds 300
}
$Host.UI.RawUI.BackgroundColor = "Black"
$Host.UI.RawUI.ForegroundColor = "Gray"
Clear-Host
}
function Test-Sound {
for($i=200; $i -le 1000; $i+=200) { [console]::Beep($i, 500) }
Write-Host "successfully tested your machines sound" -ForegroundColor Green
}
function Emergency-Restart {
Write-Host "Restarting Pc"
Restart-Computer -Force
}
function Emergency-Shutdown {
# Keep your original Base64 logic here
Write-Host "Shutting down..."
Stop-Computer -Force
}
# --- NEW BATCH STUFF COMMANDS ---
function Import-BatchStuff {
<# Loads the functions instantly for current window #>
Invoke-Expression $CustomCommands
Write-Host "BatchStuff functions imported to current session." -ForegroundColor Cyan
}
function Install-BatchStuff {
<# Appends the logic to the PS Profile permanently #>
if (!(Test-Path $PROFILE)) { New-Item -Path $PROFILE -Type File -Force }
$Content = Get-Content $PROFILE -Raw
if ($Content -like "*# BEGIN-BATCH-MOD*") {
Write-Warning "BatchStuff is already in your profile."
} else {
$Block = "`n# BEGIN-BATCH-MOD`n$CustomCommands`n# END-BATCH-MOD"
Add-Content -Path $PROFILE -Value $Block
Write-Host "BatchStuff installed to Profile successfully!" -ForegroundColor Green
}
}
'@
# Fixed Profile Path for compatibility with PS2EXE
$ProfilePath = "$Home\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1"
#function for the installation
function Install-Commands {
# Added this to ensure the system allows the profile to run
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser -Force
if (!(Test-Path $ProfilePath)) {
$null = New-Item -Path $ProfilePath -ItemType File -Force
}
$CurrentContent = Get-Content $ProfilePath -Raw
if ($CurrentContent -like "*# BEGIN CUSTOM COMMANDS*") {
Write-Host "Commands are already installed." -ForegroundColor Yellow
} else {
$Block = "`n# BEGIN CUSTOM COMMANDS`n$CustomCommands`n# END CUSTOM COMMANDS`n"
Add-Content -Path $ProfilePath -Value $Block
Write-Host "Successfully installed commands to $ProfilePath" -ForegroundColor Green
Write-Host "Restart PowerShell to use them." -ForegroundColor Cyan
}
}
# Function to Uninstall
function Uninstall-Commands {
if (Test-Path $ProfilePath) {
$Content = Get-Content $ProfilePath -Raw
$Pattern = "(?s)`n# BEGIN CUSTOM COMMANDS.*?# END CUSTOM COMMANDS`n"
$NewContent = $Content -replace $Pattern, ""
Set-Content -Path $ProfilePath -Value $NewContent
Write-Host "Successfully removed commands from profile." -ForegroundColor Green
} else {
Write-Host "Profile not found." -ForegroundColor Red
}
}
Write-Host "This is the installer for the Power Cobra Windows 11 Powershell Mod"
Write-Host "please choose a install option"
Write-Host "press 1 to install"
Write-Host "press 2 to uninstall"
$Choice = Read-Host "please select a option"
if ($Choice -eq "1") { Install-Commands }
elseif ($Choice -eq "2") { Uninstall-Commands }
else { Write-Host "Invalid Selection." }
#devtag
#devtag
#devtag
#devtag
#devtag
#devtag