Tekkie_Boy

Untitled

Jun 12th, 2021
67
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @echo off
  2. setlocal
  3. set KEY="HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing"
  4. set ZIPF=%USERPROFILE%\Desktop\SoftwareCBS.zip
  5.  
  6. :: Check if running Elevated...
  7. whoami /groups|find "S-1-16-12288" >NUL
  8. if %ERRORLEVEL% GEQ 1 goto :ASKELEVATED
  9. echo.
  10. echo :: Exporting Registry keys please wait!...
  11. reg save %KEY% "%userprofile%\Desktop\SoftwareCBS.hiv" /y
  12.  
  13. if not exist "%userprofile%\Desktop\SoftwareCBS.hiv" (
  14. echo.
  15. echo :: *** ERROR ***
  16. echo :: - Exporting of SoftwareCBS.hiv Failed^!^!^!
  17. GOTO :ABORT
  18. )
  19.  
  20. call :ZIPit
  21.  
  22. echo.
  23. echo - A new file called "SoftwareCBS.zip" is now on the Desktop.
  24. echo.
  25. echo Done.
  26. pause
  27. exit /b 0
  28.  
  29. :ASKELEVATED
  30. echo.
  31. echo ERROR: Please run this script using Administrator elevated privileges!
  32. echo.
  33. echo TIP: Right-click the file and select run as Administrator
  34. echo.
  35. pause
  36. exit
  37. goto :EOF
  38.  
  39. :ABORT
  40. echo :: Aborting.
  41. exit /b 1
  42.  
  43. :ZIPit
  44. set ZIPit=%temp%\_zipIt.vbs
  45. if exist "%ZIPit%" del "%ZIPit%"
  46. >>"%ZIPit%" echo Set objArgs = WScript.Arguments
  47. >>"%ZIPit%" echo InputFile = objArgs(0)
  48. >>"%ZIPit%" echo ZipFile = objArgs(1)
  49. >>"%ZIPit%" echo CreateObject("Scripting.FileSystemObject").CreateTextFile(ZipFile, True).Write "PK" ^& Chr(5) ^& Chr(6) ^& String(18, vbNullChar)
  50. >>"%ZIPit%" echo Set objShell = CreateObject("Shell.Application")
  51. >>"%ZIPit%" echo objShell.NameSpace(ZipFile).MoveHere(InputFile)
  52. >>"%ZIPit%" echo On Error Resume Next
  53. >>"%ZIPit%" echo Do Until objShell.NameSpace(ZipFile).Items.Count = 1
  54. >>"%ZIPit%" echo WScript.Sleep 200
  55. >>"%ZIPit%" echo Loop
  56.  
  57. echo.
  58. echo :: Creating Zip file on user Desktop...
  59. %systemroot%\system32\cscript.exe //nologo "%ZIPit%" "%userprofile%\Desktop\SoftwareCBS.hiv" "%ZIPF%"
  60. if exist "%ZIPit%" del "%ZIPit%"
  61. goto :EOF
RAW Paste Data