WinGet
Windows Registry Editor Version 5.00 | |
[HKEY_CLASSES_ROOT\Microsoft.PowerShellScript.1\Shell\runas] | |
"HasLUAShield"="" | |
[HKEY_CLASSES_ROOT\Microsoft.PowerShellScript.1\Shell\runas\command] | |
@="powershell.exe \"-Command\" \"if((Get-ExecutionPolicy ) -ne 'AllSigned') { Set-ExecutionPolicy -Scope Process Bypass }; & '%1'\"" | |
@echo off | |
REM Создание скриптов для winget | |
REM LINK: https://docs.microsoft.com/ru-ru/windows/package-manager/winget | |
reg.exe query "HKU\S-1-5-19">nul 2>&1 | |
if %errorlevel% equ 1 goto UACPrompt | |
color 0a | |
chcp 1251 | |
cls | |
echo Вы уверены что хотите выполнить следующий код...? | |
pause | |
goto RunScript | |
:ExiT | |
echo ===================================================== | |
echo ......Выходим...... | |
echo ===================================================== | |
TIMEOUT /T 3 /NOBREAK | |
exit | |
pause>nul | |
exit /b | |
:UACPrompt | |
mshta "vbscript:CreateObject("Shell.Application").ShellExecute("%~fs0", "", "", "runas", 1) & Close()" | |
exit /b | |
cmd | |
:RunScript | |
color 0d | |
cls | |
ECHO ======================== KOD ======================= | |
ECHO Install Gpg4win and CrystalDiskMark | |
REM gnupg.Gpg4win | |
winget install gnupg.Gpg4win --exact | |
if %ERRORLEVEL% EQU 0 ECHO Gpg4win installed successfully. | |
REM CrystalDiskMark | |
ECHO Предварительно Задана ОШИБКА !!!!! | |
winget install CrystalDewWorld.CrystalDiskMa --exact | |
if %ERRORLEVEL% EQU 0 Echo CrystalDiskMark installed successfully. %ERRORLEVEL% | |
ECHO ===================================================== | |
pause | |
cls | |
goto ExiT |
##========= Install WinGet ========= ## | |
mkdir C:\PS\ | |
##================================= | |
## Download WinGet & Install | |
##~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
##~~ WinGet v0.1.4331 | |
# Invoke-WebRequest -Uri "https://github.com/microsoft/winget-cli#/releases/download/v0.1.4331-preview/Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.appxbundle" -OutFile "C:\PS\WinGet.appxbundle" | |
##~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
## WinGet v0.2.2941 | |
Invoke-WebRequest -Uri "https://github.com/microsoft/winget-cli/releases/download/v0.2.2941-preview/Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.appxbundle" -OutFile "$env:SYSTEMDRIVE\PS\WinGet.appxbundle" | Add-AppxPackage "$env:SYSTEMDRIVE\PS\WinGet.appxbundle"; | |
##================================= | |
## Add SUDO | |
function AddSudo () { | |
##________________________________________ | |
Invoke-WebRequest -Uri "https://gist.githubusercontent.com/numbnet/d0604532adb8fd7c3d6c03bfc7fd4058/raw/e769ad96e02702d4b9e999cd829bfab2877c3086/sudo.bat" -OutFile "$env:WINDIR\sudo.bat" | |
} | |
function RunAs () { | |
param([switch]$Elevated) | |
function Test-Admin { | |
$currentUser = New-Object Security.Principal.WindowsPrincipal $([Security.Principal.WindowsIdentity]::GetCurrent()) | |
$currentUser.IsInRole([Security.Principal.WindowsBuiltinRole]::Administrator) | |
} | |
if ((Test-Admin) -eq $false) { | |
if ($elevated) | |
{ | |
# tried to elevate, did not work, aborting | |
} | |
else { | |
Start-Process powershell.exe -Verb RunAs -ArgumentList ('-noprofile -noexit -file "{0}" -elevated' -f ($myinvocation.MyCommand.Definition)) | |
} | |
exit | |
} | |
} | |
RunAs | |
AddSudo | |
##======================================================= | |
## install APPX | |
# winget install "Microsoft.VisualStudioCode" --force | |
winget install "Microsoft.WindowsTerminal" --silent | |
winget install "wget" --force | |
winget install "grep" --silent | |
#winget install "Xampp" --silent | |
#winget install "CodeLite.CodeLite" --silent | |
winget install "Git.Git" --force | |
#### install NodeJS & Tools (Chocolatey, python,visualstudio2019-workload-vctools ) | |
winget install "OpenJS.NodeJS" --silent | |
Invoke-WebRequest -Uri "https://gist.githubusercontent.com/numbnet/d0604532adb8fd7c3d6c03bfc7fd4058/raw/14b3c150fd4432e5896ac2efa12b45be8915318b/install_tools.bat" -OutFile "$env:ProgramFiles\nodejs\install_tools.bat" | . "$env:ProgramFiles\nodejs\install_tools.bat"; | |
Invoke-WebRequest -Uri "https://gist.githubusercontent.com/numbnet/d0604532adb8fd7c3d6c03bfc7fd4058/raw/14b3c150fd4432e5896ac2efa12b45be8915318b/addRunas.ClickMous.reg" -OutFile "$env:SYSTEMDRIVE\addRunas.ClickMous.reg" | . "$env:SYSTEMDRIVE\addRunas.ClickMous.reg"; | |
##======================================================= | |
#### node vars | |
Invoke-WebRequest -Uri "https://gist.githubusercontent.com/numbnet/d0604532adb8fd7c3d6c03bfc7fd4058/raw/14b3c150fd4432e5896ac2efa12b45be8915318b/nodevars.bat" -OutFile "$env:ProgramFiles\nodejs\nodevars.bat" | . "$env:ProgramFiles\nodejs\nodevars.bat"; | |
##======================================================= | |
#### install Nodist | |
winget install "Nodist.Nodist" --silent | |
# cd $env:USERPROFILE | npm install --global windows-build-tools | |
##======================================================= | |
#### Add APPX | |
# winget install "Sublime Merge" --silent | |
winget install "NuGetPackageExplorer.NuGetPackageExplorer" --silent | |
winget search 'Microsoft.VC++' | |
winget install "Microsoft.PowerShell" --silent | |
#winget install "Microsoft.PowerShell-Preview" --silent | |
#Find-Module Posh-SSH | Install-Module | |
#Import-Module Posh-SSH | |
#Install-Module -Name Posh-SSH | |
#iex (New-Object Net.WebClient).DownloadString("https://gist.github.com/darkoperator/6152630/raw/c67de4f7cd780ba367cccbc2593f38d18ce6df89/instposhsshdev") | |
@echo off | |
setlocal | |
title Install Additional Tools for Node.js | |
cls | |
echo ==================================================== | |
echo Tools for Node.js Native Modules Installation Script | |
echo ==================================================== | |
echo. | |
echo This script will install Python and the Visual Studio Build Tools, necessary | |
echo to compile Node.js native modules. Note that Chocolatey and required Windows | |
echo updates will also be installed. | |
echo. | |
echo This will require about 3 Gb of free disk space, plus any space necessary to | |
echo install Windows updates. This will take a while to run. | |
echo. | |
echo Please close all open programs for the duration of the installation. If the | |
echo installation fails, please ensure Windows is fully updated, reboot your | |
echo computer and try to run this again. This script can be found in the | |
echo Start menu under Node.js. | |
echo. | |
echo You can close this window to stop now. Detailed instructions to install these | |
echo tools manually are available at https://github.com/nodejs/node-gyp#on-windows | |
echo. | |
pause | |
cls | |
REM Adapted from https://github.com/Microsoft/windows-dev-box-setup-scripts/blob/79bbe5bdc4867088b3e074f9610932f8e4e192c2/README.md#legal | |
echo Using this script downloads third party software | |
echo ------------------------------------------------ | |
echo This script will direct to Chocolatey to install packages. By using | |
echo Chocolatey to install a package, you are accepting the license for the | |
echo application, executable(s), or other artifacts delivered to your machine as a | |
echo result of a Chocolatey install. This acceptance occurs whether you know the | |
echo license terms or not. Read and understand the license terms of the packages | |
echo being installed and their dependencies prior to installation: | |
echo - https://chocolatey.org/packages/chocolatey | |
echo - https://chocolatey.org/packages/python | |
echo - https://chocolatey.org/packages/visualstudio2019-workload-vctools | |
echo. | |
echo This script is provided AS-IS without any warranties of any kind | |
echo ---------------------------------------------------------------- | |
echo Chocolatey has implemented security safeguards in their process to help | |
echo protect the community from malicious or pirated software, but any use of this | |
echo script is at your own risk. Please read the Chocolatey's legal terms of use | |
echo as well as how the community repository for Chocolatey.org is maintained. | |
echo. | |
pause | |
cls | |
"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command Start-Process '%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe' -ArgumentList '-NoProfile -InputFormat None -ExecutionPolicy Bypass -Command [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; iex ((New-Object System.Net.WebClient).DownloadString(''https://chocolatey.org/install.ps1'')); choco upgrade -y python visualstudio2019-workload-vctools; Read-Host ''Type ENTER to exit'' ' -Verb RunAs |
##=== OpenSSH Win10 === | |
echo "----------- !!! START !!! ----------" | |
## ================= ≠≠≠ ================= | |
param([switch]$Elevated) | |
function TestAdmin { | |
$currentUser = New-Object Security.Principal.WindowsPrincipal $([Security.Principal.WindowsIdentity]::GetCurrent()) | |
$currentUser.IsInRole([Security.Principal.WindowsBuiltinRole]::Administrator) | |
} | |
if ((TestAdmin) -eq $false) { | |
if ($elevated) | |
{ | |
echo "# tried to elevate, did not work, aborting #" | |
} | |
else { | |
Start-Process powershell.exe -Verb RunAs -ArgumentList ('-noprofile -noexit -file "{0}" -elevated' -f ($myinvocation.MyCommand.Definition)) | |
} | |
} | |
## ================= ≠≠≠ ================= | |
function QUIT() { | |
echo "----------- QUIT ----------" | |
pause | |
Stop-Process -Name powershell -Force | |
# TIMEOUT /T 5 /NOBREAK | |
#Get-Process powershell | Stop-Process -Force | |
} | |
## ================= ≠≠≠ ================= | |
if ((TestAdmin) -eq $true) { | |
echo "******** !!! RUN !!! *******" | |
TIMEOUT /T 3 /NOBREAK | |
} | |
else { | |
pause | |
QUIT | |
##Get-Process powershell | Stop-Process -Force | |
} | |
########################################## | |
## ================= ≠≠≠ ================= | |
### START install OpenSSH x64 or x86 | |
echo " # Add New Directory "; | |
pause | |
New-Item -Path "$env:SYSTEMDRIVE\" -Name "PS\OpenSSH" -ItemType Directory -force; | |
## ================= ≠≠≠ ================= | |
### ОПРЕДЕЛЯЕМ АРХИТЕКТУРУ os Download OpenSSH x64 or x86 | |
echo "Определяем архитектуру и розрядность"; | |
pause | |
If([IntPtr]::Size -eq 4) | |
{ | |
Write-Host "Windows x86"; # OpenSSH --x32 | |
echo "##--------v8.1.0.0p1-Beta------------"; | |
pause | |
Invoke-WebRequest -Uri "https://github.com/numbnet/Win10andAppx/releases/download/v8.1.0.0p1-Beta/OpenSSH-Win32.zip" -OutFile "$env:SYSTEMDRIVE\PS\OpenSSH\OpenSSH-Win32.zip" | |
## ================= ≠≠≠ ================= | |
echo "======= Unzip the files==================="; | |
pause | |
Expand-Archive -Path $env:SYSTEMDRIVE\PS\OpenSSH\OpenSSH-Win32.Zip -DestinationPath $env:ProgramFiles\OpenSSH\; | |
## ================= ≠≠≠ ================= | |
echo "======= Copy \OpenSSH\OpenSSH-Win32\ \OpenSSH ==============="; | |
pause | |
copy $env:ProgramFiles\OpenSSH\OpenSSH-Win32\* $env:ProgramFiles\OpenSSH; | |
} | |
Else | |
{ | |
Write-Host "Windows x64"; ##---------v8.1.0.0p1-Beta----------- | |
pause | |
Invoke-WebRequest -Uri "https://github.com/numbnet/Win10andAppx/releases/download/v8.1.0.0p1-Beta/OpenSSH-Win64.zip" -OutFile "$env:SYSTEMDRIVE\PS\OpenSSH\OpenSSH-Win64.zip" | |
## ================= ≠≠≠ ================= | |
echo "======= Unzip the files===========" | |
pause | |
Expand-Archive -Path "$env:SYSTEMDRIVE\PS\OpenSSH\OpenSSH-Win64.Zip" -DestinationPath "$env:ProgramFiles\OpenSSH\"; | |
## ================= ≠≠≠ ================= | |
echo "======= Copy \OpenSSH\OpenSSH-Win64\ \OpenSSH=============" | |
pause | |
copy $env:ProgramFiles\OpenSSH\OpenSSH-Win64\* $env:ProgramFiles\OpenSSH; | |
} | |
## ================= ≠≠≠ ================= | |
echo "======= Install service " | |
pause | |
. "$env:ProgramFiles\OpenSSH\install-sshd.ps1"; | |
## ================= ≠≠≠ ================= | |
echo "======= Set firewall permissions" | |
pause | |
New-NetFirewallRule -Name sshd -DisplayName 'OpenSSH Server (sshd)' -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22; | |
## ================= ≠≠≠ ================= | |
echo "======= Set service startup END" | |
pause | |
Set-Service sshd -StartupType Automatic; | |
Start-Service sshd; | |
## ================= ≠≠≠ ================= | |
echo "======= Set Authentication to public key" | |
pause | |
((Get-Content -path $env:ProgramData\ssh\sshd_config -Raw) ` -replace '#PubkeyAuthentication yes','PubkeyAuthentication yes' ` -replace '#PasswordAuthentication yes','PasswordAuthentication yes' ` -replace 'Match Group administrators','#Match Group administrators' ` -replace 'AuthorizedKeysFile __PROGRAMDATA__/ssh/administrators_authorized_keys','#AuthorizedKeysFile __PROGRAMDATA__/ssh/administrators_authorized_keys') | Set-Content -Path $env:ProgramData\ssh\sshd_config; | |
## ================= ≠≠≠ ================= | |
echo "======= Restart after changes" | |
pause | |
Restart-Service sshd; | |
## ================= ≠≠≠ ================= | |
echo "======= force file creation" | |
pause | |
New-item -Path $env:USERPROFILE -Name .ssh -ItemType Directory -force; | |
## ================= ≠≠≠ ================= | |
echo "## Gen SSH-KEY:" | |
pause | |
# ssh-keygen -t ed25519 -C "$env:USERNAME" -f $env:USERPROFILE\.ssh\$env:COMPUTERNAME.$(Get-Random).ed25519.key | Out-File $env:USERPROFILE\.ssh\file.log -Encoding ascii; | |
ssh-keygen -t ed25519 -C "$env:USERNAME" -f "$env:USERPROFILE\.ssh\$env:COMPUTERNAME.$env:USERNAME.ed25519.key"; | |
## ================= ≠≠≠ ================= | |
## Copy SSH-KEY V1: | |
# echo "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKp3bxeApwQec9N6DaIP1Iq3o7Ks4jcL66wHi1YdqkFC root" | Out-File $env:USERPROFILE\.ssh\authorized_keys -Encoding ascii; | |
echo "======= Copy SSH-KEY V2:" | |
pause | |
cat $env:USERPROFILE\.ssh\*$env:COMPUTERNAME.$env:USERNAME.ed25519.key.pub | Out-File $env:USERPROFILE\.ssh\authorized_keys -Encoding ascii; | |
## ================= ≠≠≠ ================= | |
echo "======= Cleaning Dir"; | |
pause | |
Remove-Item -Path $env:SYSTEMDRIVE\PS\OpenSSH -Recurse; | |
If([IntPtr]::Size -eq 4) | |
{ | |
Write-Host "Windows x86"; | |
pause | |
Remove-Item -Path $env:ProgramFiles\OpenSSH\OpenSSH-Win32 -Recurse; | |
} | |
Else | |
{ | |
Write-Host "Windows x64"; | |
pause | |
Remove-Item -Path $env:ProgramFiles\OpenSSH\OpenSSH-Win64 -Recurse; | |
} | |
## ================= ≠≠≠ ================= | |
echo "----------- !!! ALL DONE !!! ----------" | |
QUIT | |
## ================= ≠≠≠ ================= | |
##================= INFO ================= | |
## Variant 1 | |
# if ((Get-WmiObject win32_operatingsystem | select osarchitecture).osarchitecture -like "64*") | |
# {Write "Windows x64";} | |
# else | |
# {Write "Windows x86";} | |
## ================= ≠≠≠ ================= | |
## Variant 2 | |
# If([IntPtr]::Size -eq 4) | |
# { | |
# Write-Host "32 bit" | |
# } | |
# Else | |
# { | |
# Write-Host "64 bit" | |
# } |
############## install WinGet ############## | |
##======================================================= | |
## New Item | |
New-Item -Path $env:SYSTEMDRIVE -Name "PS" -ItemType Directory -force; | |
##======================================================= | |
## install WinGet | |
mkdir C:\PS\ | |
##------------------- | |
# Invoke-WebRequest -Uri "https://github.com/microsoft/winget-cli/releases/download/v0.1.4331-preview/Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.appxbundle" -OutFile "C:\PS\WinGet.appxbundle" | |
##------------------- | |
Invoke-WebRequest -Uri "https://github.com/microsoft/winget-cli/releases/download/v0.2.2941-preview/Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.appxbundle" -OutFile "C:\PS\WinGet.appxbundle" | Add-AppxPackage "C:\PS\WinGet.appxbundle" | |
##======================================================= | |
## install APPX | |
##======================================================= | |
#### install NodeJS & Tools (Chocolatey, python,visualstudio2019-workload-vctools ) | |
winget install "OpenJS.NodeJS" --silent | |
Invoke-WebRequest -Uri "https://gist.githubusercontent.com/numbnet/d0604532adb8fd7c3d6c03bfc7fd4058/raw/14b3c150fd4432e5896ac2efa12b45be8915318b/install_tools.bat" -OutFile "$env:ProgramFiles\nodejs\install_tools.bat" | . "$env:ProgramFiles\nodejs\install_tools.bat"; | |
Invoke-WebRequest -Uri "https://gist.githubusercontent.com/numbnet/d0604532adb8fd7c3d6c03bfc7fd4058/raw/14b3c150fd4432e5896ac2efa12b45be8915318b/addRunas.ClickMous.reg" -OutFile "$env:SYSTEMDRIVE\PS\addRunas.ClickMous.reg" | . "$env:SYSTEMDRIVE\addRunas.ClickMous.reg"; | |
##======================================================= | |
winget install "Microsoft.PowerShell" --silent | |
winget install "GnuWin32.Wget" --silent | |
winget install "GnuWin32.Zip" --silent | |
winget install "GnuWin32.Make" --silent | |
winget install "GnuWin32.Grep" --silent | |
winget install "NuGetPackageExplorer.NuGetPackageExplorer" --silent | |
winget search 'Microsoft.VC++' | |
winget install "Microsoft.VisualStudioCode" --force | |
winget install "Microsoft.WindowsTerminal" --silent | |
# winget install "Xampp" --silent | |
# winget install "CodeLite.CodeLite" --silent | |
winget install "Git.Git" --silent | |
winget install "Nodist.Nodist" --silent ; cd $env:USERPROFILE | npm install --global windows-build-tools | |
winget install "Microsoft.PowerShell-Preview" --silent | |
winget install "OpenHashTab" --silent | |
winget install "Gpg4win" --silent | |
winget install "7zip.7zip" --silent | |
winget install "AIMP.AIMP" --silent | |
winget install "Win32diskimager.win32diskimager" --silent | |
winget install "CodecGuide.K-LiteCodecPackStandard" --silent | |
#winget install "GitHub.GitHubDesktop" --silent | |
#winget install "Google.Chrome" --silent | |
winget install "Google.BackupAndSync" --silent | |
winget install "gnupg.Gpg4win" --silent | |
winget install "HandyOrg.HandyWinget-GUI" --silent | |
winget install "HeidiSQL.HeidiSQL" --silent | |
winget install "scottlerch.hosts-file-editor" --silent | |
winget install "GnuWin32.Make" --silent | |
#winget install "Oracle.MySQL" --silent | |
#winget install "Notepad++.Notepad++" --silent | |
#winget install "Opera.Opera" --silent | |
#winget install "Oracle.VirtualBox" --silent | |
winget install "PuTTY.PuTTY" --silent | |
winget install "Rufus.Rufus" --silent | |
#winget install "SublimeHQ.SublimeText" --silent | |
#winget install "SublimeHQ.SublimeMerge" --silent | |
#winget install "Telegram.TelegramDesktop" --silent | |
winget install "WinMerge" --silent | |
winget install "RARLab.WinRAR" --silent | |
winget install "WinSCP.WinSCP" --silent | |
winget install "ApacheFriends.Xampp" --silent | |
winget install "appget.appget" --silent | |
#winget install "gerardog.gsudo" --silent | |
##======================================================= | |
## install APPX | |
winget install "Microsoft.PowerShell" --silent | |
winget search 'Microsoft.VC++' | |
winget search "RARLab.WinRAR" | |
winget install "Microsoft.VisualStudioCode" --force | |
winget install "Microsoft.WindowsTerminal" --silent | |
winget install "CodeLite.CodeLite" --silent | |
winget install "OpenJS.NodeJS" --silent | |
##======================================================= | |
## install Posh-SSH | |
Find-Module Posh-SSH | Install-Module | |
Import-Module Posh-SSH; Install-Module -Name Posh-SSH | |
iex (New-Object Net.WebClient).DownloadString("https://gist.github.com/darkoperator/6152630/raw/c67de4f7cd780ba367cccbc2593f38d18ce6df89/instposhsshdev") | |
####======================================================= | |
#### ADD sudo | |
function AddSudo { | |
####==================================================== | |
#### | |
Invoke-WebRequest -Uri "https://gist.githubusercontent.com/numbnet/d0604532adb8fd7c3d6c03bfc7fd4058/raw/e769ad96e02702d4b9e999cd829bfab2877c3086/sudo.bat" -OutFile "$env:WINDIR\sudo.bat" | |
} | |
function RunAs { | |
param([switch]$Elevated) | |
function Test-Admin { | |
$currentUser = New-Object Security.Principal.WindowsPrincipal $([Security.Principal.WindowsIdentity]::GetCurrent()) | |
$currentUser.IsInRole([Security.Principal.WindowsBuiltinRole]::Administrator) | |
} | |
if ((Test-Admin) -eq $false) { | |
if ($elevated) | |
{ | |
# tried to elevate, did not work, aborting | |
} | |
else { | |
Start-Process powershell.exe -Verb RunAs -ArgumentList ('-noprofile -noexit -file "{0}" -elevated' -f ($myinvocation.MyCommand.Definition)) | |
} | |
exit | |
} | |
} | |
RunAs | |
AddSudo | |
$webclient = New-Object System.Net.WebClient | |
$url = "https://github.com/darkoperator/Posh-SSH/archive/master.zip" | |
Write-Host "Downloading latest version of Posh-SSH from $url" -ForegroundColor Cyan | |
$file = "$($env:TEMP)\Posh-SSH.zip" | |
$webclient.DownloadFile($url,$file) | |
Write-Host "File saved to $file" -ForegroundColor Green | |
$targetondisk = "$($env:USERPROFILE)\Documents\WindowsPowerShell\Modules" | |
New-Item -ItemType Directory -Force -Path $targetondisk | out-null | |
$shell_app=new-object -com shell.application | |
$zip_file = $shell_app.namespace($file) | |
Write-Host "Uncompressing the Zip file to $($targetondisk)" -ForegroundColor Cyan | |
$destination = $shell_app.namespace($targetondisk) | |
$destination.Copyhere($zip_file.items(), 0x10) | |
Write-Host "Renaming folder" -ForegroundColor Cyan | |
Rename-Item -Path ($targetondisk+"\Posh-SSH-master") -NewName "Posh-SSH" -Force | |
Write-Host "Module has been installed" -ForegroundColor Green | |
Import-Module -Name posh-ssh | |
Get-Command -Module Posh-SSH |
REM ===============KitKatDeodexer.bat================= | |
@echo off | |
java -version | |
if errorlevel 1 goto javaerror | |
if exist %~dp0 goto menu | |
REM ======================================== | |
REM | |
:menu | |
echo ======================================== | |
echo KitKat Deodexer | |
echo ---------------------------------------- | |
echo Main Menu | |
echo ---------------------------------------- | |
echo 1 : Create working directory | |
echo 2 : Pull files from your device | |
echo 3 : Deodex all files | |
echo 4 : Add deodexed files to zip | |
echo ---------------------------------------- | |
echo x : Exit | |
echo i : Info | |
echo ======================================== | |
set /p NUM="Choice :" | |
if "%NUM%"=="1" goto wodir | |
if "%NUM%"=="2" goto pfile | |
if "%NUM%"=="3" goto dex | |
if "%NUM%"=="4" goto azip | |
if "%NUM%"=="x" goto quit | |
if "%NUM%"=="i" goto info | |
:wodir | |
cls | |
@echo Creating working directory and system\app system\framework system\priv-app folders... | |
@echo app | |
mkdir system | |
mkdir system\app | |
mkdir system\priv-app | |
mkdir system\framework | |
mkdir work | |
pause | |
cls | |
goto menu | |
:pfile | |
cls | |
cmd\adb wait-for-device | |
@echo Pulling files from your device... | |
cmd\adb pull /system/app system\app | |
cmd\adb pull /system/priv-app system\priv-app | |
cmd\adb pull /system/framework system\framework | |
pause | |
cls | |
goto menu | |
:dex | |
cls | |
@echo; | |
@echo Starting deodex... | |
for %%i in (system\app\*.apk) do ( | |
if exist system\app\%%~ni.odex ( | |
java -jar cmd\baksmali.jar -d system\framework -x system\app\%%~ni.odex -o work\%%~ni | |
java -jar cmd\smali.jar work\%%~ni -o classes.dex | |
cmd\7za a -tzip %%i classes.dex | |
del classes.dex | |
rmdir /Q /S work\%%~ni | |
del system\app\%%~ni.odex | |
) | |
) | |
for %%i in (system\priv-app\*.apk) do ( | |
if exist system\priv-app\%%~ni.odex ( | |
java -jar cmd\baksmali.jar -d system\framework -x system\priv-app\%%~ni.odex -o work\%%~ni | |
java -jar cmd\smali.jar work\%%~ni -o classes.dex | |
cmd\7za a -tzip %%i classes.dex | |
del classes.dex | |
rmdir /Q /S work\%%~ni | |
del system\priv-app\%%~ni.odex | |
) | |
) | |
for %%i in (system\framework\*.apk) do ( | |
if exist system\framework\%%~ni.odex ( | |
java -jar cmd\baksmali.jar -d system\framework -x system\framework\%%~ni.odex -o work\%%~ni | |
java -jar cmd\smali.jar work\%%~ni -o classes.dex | |
cmd\7za a -tzip %%i classes.dex | |
del classes.dex | |
rmdir /Q /S work\%%~ni | |
del system\framework\%%~ni.odex | |
) | |
) | |
for %%i in (system\framework\*.jar) do ( | |
if exist system\framework\%%~ni.odex ( | |
java -jar cmd\baksmali.jar -d system\framework -x system\framework\%%~ni.odex -o work\%%~ni | |
java -jar cmd\smali.jar work\%%~ni -o classes.dex | |
cmd\7za a -tzip %%i classes.dex | |
del classes.dex | |
rmdir /Q /S work\%%~ni | |
del system\framework\%%~ni.odex | |
) | |
) | |
@echo; | |
@echo deodexed files are stored in system\app, system\priv-app, system\framework folder. | |
pause | |
cls | |
goto menu | |
:azip | |
cls | |
@echo; | |
@echo Adding deodexed files to deodex_install.zip | |
cmd\7za a -tzip deodex_install.zip system | |
@echo Completed. | |
pause | |
:info | |
cls | |
echo ======================== INFO ======================= | |
echo This is a deodexer for KitKat Roms | |
echo This tool is based on Kamome deodexer for Xperia 4.4 | |
echo May work on all odexed kitkat roms | |
echo Always do a nandroid backup before installing | |
echo Do with your own risk | |
echo ===================================================== | |
pause | |
cls | |
goto menu | |
:javaerror | |
cls | |
echo Java is not installed, please install java to deodex | |
echo If you dont install java, maybe some error will occur | |
pause | |
cls | |
goto menu | |
:quit |
@echo off | |
rem Ensure this Node.js and npm are first in the PATH | |
set "PATH=%APPDATA%\npm;%~dp0;%PATH%" | |
setlocal enabledelayedexpansion | |
pushd "%~dp0" | |
rem Figure out the Node.js version. | |
set print_version=.\node.exe -p -e "process.versions.node + ' (' + process.arch + ')'" | |
for /F "usebackq delims=" %%v in (`%print_version%`) do set version=%%v | |
rem Print message. | |
if exist npm.cmd ( | |
echo Your environment has been set up for using Node.js !version! and npm. | |
) else ( | |
echo Your environment has been set up for using Node.js !version!. | |
) | |
popd | |
endlocal | |
rem If we're in the Node.js directory, change to the user's home dir. | |
if "%CD%\"=="%~dp0" cd /d "%HOMEDRIVE%%HOMEPATH%" |
####==================================================== | |
#### Run script as admin(cmd/batch-file command): | |
cmd powershell -command " Start-Process PowerShell -Verb RunAs \""-Command `\""cd '%cd%'; & 'InstallWinGet.ps1';`\""\"" "; | |
####==================================================== | |
#### Run script as admin(powershell-file command): | |
Start-Process powershell -verb runas -ArgumentList "-file fullpathofthescript" | |
REM ==================================================== | |
REM #### Run script as admin(cmd/batch-file command): | |
powershell -command " Start-Process PowerShell -Verb RunAs \""-Command `\""cd '%cd%'; & 'InstallWinGet.ps1';`\""\"" "; | |
REM ####==================================================== | |
REM #### Run script as admin(powershell-file command): | |
REM Start-Process powershell -verb runas -ArgumentList "-file fullpathofthescript" | |
##==================================================== | |
## Добавьте это в начало сценария: | |
$currentUser = New-Object Security.Principal.WindowsPrincipal $([Security.Principal.WindowsIdentity]::GetCurrent()) | |
$testadmin = $currentUser.IsInRole([Security.Principal.WindowsBuiltinRole]::Administrator) | |
if ($testadmin -eq $false) { | |
Start-Process powershell.exe -Verb RunAs -ArgumentList ('-noprofile -noexit -file "{0}" -elevated' -f ($myinvocation.MyCommand.Definition)) | |
exit $LASTEXITCODE | |
} | |
##==================================================== | |
## START сценария: | |
echo '===========Is WORKING=============' | |
echo "PS1 is Starting" | |
##==================================================== |
####==================================================== | |
#### Run script as admin(powershell-file command): | |
$ErrorActionPreference = 'Stop' | |
$si = New-Object System.Diagnostics.ProcessStartInfo | |
$si.FileName = $args[0] | |
$si.Arguments = [String]::Join(' ', $args[1..($args.Count - 1)]) | |
$si.Verb = 'RunAs' | |
$si.UseShellExecute = $true | |
$process = [System.Diagnostics.Process]::Start($si) | |
echo "===============START=================" | |
# Very strange code... | |
# But I spy it in MSBuild... | |
# I hope these guys know what they are doing! :) | |
$process.WaitForExit() | |
do | |
{ | |
[System.Threading.Thread]::Sleep(0) | |
} | |
while (!$process.HasExited) | |
Exit $process.ExitCode | |
## ================= ≠≠≠ ================= | |
#!# function RunAs { | |
param([switch]$Elevated) | |
function TestAdmin { | |
$currentUser = New-Object Security.Principal.WindowsPrincipal $([Security.Principal.WindowsIdentity]::GetCurrent()) | |
$currentUser.IsInRole([Security.Principal.WindowsBuiltinRole]::Administrator) | |
} | |
if ((TestAdmin) -eq $false) { | |
if ($elevated) | |
{ | |
# tried to elevate, did not work, aborting | |
} | |
else { | |
Start-Process powershell.exe -Verb RunAs -ArgumentList ('-noprofile -noexit -file "{0}" -elevated' -f ($myinvocation.MyCommand.Definition)) | |
} | |
exit | |
} | |
#!# }RunAs | |
'!!! IT WORKS !!!' | |
echo "Running with FULL Privileges" | |
echo "=========== !!! WORKS !!! ==========" | |
pau | |
exit 0 |
## ================= ≠≠≠ ================= | |
#!# function RunAs { | |
param([switch]$Elevated) | |
function TestAdmin { | |
$currentUser = New-Object Security.Principal.WindowsPrincipal $([Security.Principal.WindowsIdentity]::GetCurrent()) | |
$currentUser.IsInRole([Security.Principal.WindowsBuiltinRole]::Administrator) | |
} | |
if ((TestAdmin) -eq $false) { | |
if ($elevated) | |
{ | |
echo "# tried to elevate, did not work, aborting #" | |
} | |
else { | |
Start-Process powershell.exe -Verb RunAs -ArgumentList ('-noprofile -noexit -file "{0}" -elevated' -f ($myinvocation.MyCommand.Definition)) | |
} | |
} | |
## ================= ≠≠≠ ================= | |
function QUIT() { | |
echo "----------- QUIT ----------" | |
TIMEOUT /T 5 /NOBREAK | |
Get-Process powershell | Stop-Process -Force | |
} | |
## ================= ≠≠≠ ================= | |
if ((TestAdmin) -eq $true) { | |
echo "******** !!! RUN !!! *******" | |
TIMEOUT /T 5 /NOBREAK | |
} | |
else { | |
echo "=========== !!! STOPED WORKS !!! ==========" | |
pause | |
QUIT || Stop-Process -Name powershell -Force | |
##Get-Process powershell | Stop-Process -Force | |
} | |
######################################################### | |
'########!!! IT WORKS !!!#######' | |
echo "Running with FULL Privileges" | |
TIMEOUT /T 3 /NOBREAK | |
echo "=========== !!! EXIT !!! ==========" | |
pause | |
######################################################### | |
QUIT |
@echo off | |
REM ============ ::: ============ | |
REM START Script as Administration | |
reg.exe query "HKU\S-1-5-19">nul 2>&1 | |
if %errorlevel% equ 1 goto UACPrompt | |
color 0a | |
chcp 1251 | |
cls | |
pause | |
goto RunScript | |
:RunScript | |
cls | |
echo ======================== KOD ======================= | |
echo . | |
echo . | |
echo . | |
echo . | |
echo . | |
echo ===================================================== | |
pause | |
cls | |
goto ExiT | |
:ExiT | |
TIMEOUT /T 3 /NOBREAK | |
exit | |
pause>nul | |
exit /b | |
:UACPrompt | |
mshta "vbscript:CreateObject("Shell.Application").ShellExecute("%~fs0", "", "", "runas", 1) & Close()" | |
exit /b | |
cmd |
@echo off | |
REM Создание скриптов для winget | |
REM LINK: https://docs.microsoft.com/ru-ru/windows/package-manager/winget | |
reg.exe query "HKU\S-1-5-19">nul 2>&1 | |
if %errorlevel% equ 1 goto UACPrompt | |
color 0a | |
chcp 1251 | |
cls | |
echo Вы уверены что хотите выполнить следующий код...? | |
pause | |
goto RunScript | |
:ExiT | |
echo ===================================================== | |
echo ......Выходим...... | |
echo ===================================================== | |
TIMEOUT /T 3 /NOBREAK | |
exit | |
pause>nul | |
exit /b | |
:UACPrompt | |
mshta "vbscript:CreateObject("Shell.Application").ShellExecute("%~fs0", "", "", "runas", 1) & Close()" | |
exit /b | |
cmd | |
:RunScript | |
color 0d | |
cls | |
ECHO ======================== KOD ======================= | |
ECHO Install Gpg4win and CrystalDiskMark | |
REM gnupg.Gpg4win | |
winget install gnupg.Gpg4win --exact | |
if %ERRORLEVEL% EQU 0 ECHO Gpg4win installed successfully. | |
REM CrystalDiskMark | |
winget install CrystalDewWorld.CrystalDiskMa --exact | |
if %ERRORLEVEL% EQU 0 Echo CrystalDiskMark installed successfully. %ERRORLEVEL% | |
ECHO ===================================================== | |
pause | |
cls | |
goto ExiT |
@echo off | |
REM ##================================================ | |
REM Arhitecture x64 x86 | |
if "%PROCESSOR_ARCHITECTURE%" == "x86" ( | |
echo "Windows x86" | |
) else ( | |
echo "Windows x64" | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment