abbodi1406's Batch Scripts Repo

Discussion in 'Scripting' started by abbodi1406, May 4, 2017.

  1. abbodi1406

    abbodi1406 MDL KB0000001

    Feb 19, 2011
    16,226
    84,921
    340
    W10UI v5.0

    - Fixed confliction issue in detecting offline partition as target, if it had boot files
    - Added Mount & Extraction directories options to main menu
     
  2. Enthousiast

    Enthousiast MDL Tester

    Oct 30, 2009
    47,292
    94,815
    450
    @abbodi1406 you forgot to update the ESD>ISO version info at the table on the OP :) It's stil showing v38 instead of v39.
     
  3. @abbodi1406 Recently i faced many situations where i couldn't activate the office bcoz it was simply not detecting in kms script, but i've also faced situations where office failed to activate even if office was detected in script. somehow after some restarts activation was successful, but in some cases activation wasnt successful even after many restarts. script i'm talking about is "sppext method and also its separate local activation.cmd for online.
    I dont know what causes the activation to failed, or even stuck long time in activating.

    do you think that a script can be made to verify and check if windows and office kms related components are running okay or not, and if found not running okay then script tries to fix the problem.
     
  4. abbodi1406

    abbodi1406 MDL KB0000001

    Feb 19, 2011
    16,226
    84,921
    340
    I don't exactly know which system components affect the KMS
    sppsvc, winmgmt, RpcSs services are core part
     
  5. l33tissw00t

    l33tissw00t MDL Addicted

    Dec 6, 2012
    819
    520
    30
    I've noticed I sometimes have to hit a key on the keyboard (i use spacebar) to trigger it to move along..
     
  6. i keep my pc in default settings as much as possible, i don't tweak much and sfc scan don't find errors but still sometime i face errors in office activation.
    on s1ave77 win 10 activation page i've read a user reported how his activation was successful after using tweaking windows repair software.
    but for me using those software may result in more harm then good, i only prefer them when i see windows is too much broken and i see it as last chance before i reinstall the system.
    i think that a tool/script for verifying/repairing activation related component is very necessary and it can be very useful.
    if anyone have knowledge in this area then please give it some thoughts. script can always develop itself later with users reports and inputs.
     
  7. Thomas Dubreuil

    Thomas Dubreuil MDL Senior Member

    Aug 29, 2017
    363
    620
    10
    I agree it can do more harm then good especially when running those repairs "blindly"...
    In that case tweaking windows repair was only used as tool to restore "default services startup".
    Apparently, activation depends from more services than Wupdate and software protection (and rpc and wmi), haven't found which one in particular.
    (But that was for digital, kms always worked.)
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  8. Kevin Rosas

    Kevin Rosas MDL Member

    Nov 27, 2016
    159
    104
    10
    Excellent. Funtional all.
     
  9. abbodi1406

    abbodi1406 MDL KB0000001

    Feb 19, 2011
    16,226
    84,921
    340
  10. armond

    armond MDL Addicted

    Jun 16, 2008
    734
    235
    30
    Well, I cannot understand the ISO creation issue you fixed? It always worked for me.
    So was there an error in the command you used to make the resulting ISO bootable? or something else?
    Thanks.
     
  11. Enthousiast

    Enthousiast MDL Tester

    Oct 30, 2009
    47,292
    94,815
    450
    It works for me too, W10UI_5.0 did create perfectly bootable iso's (x86 and x64, both working fine).
     
  12. abbodi1406

    abbodi1406 MDL KB0000001

    Feb 19, 2011
    16,226
    84,921
    340
    Well, neither i do :D

    i only noticed extra accidental " in the set isofile line
    whether it was the cause, or the issue is just temporary with the user, i don't know
    but still, should be removed :)
     
  13. GOD666

    GOD666 MDL Expert

    Aug 1, 2015
    1,958
    2,061
    60
    I am always surprised by you @abbodi1406 and how much effort and work you put into here. I know most folks just seem to ask for more, but I wanted to take a moment today and thank you for all the hard effort you put into everything that you do. :)
     
  14. abbodi1406

    abbodi1406 MDL KB0000001

    Feb 19, 2011
    16,226
    84,921
    340
    Updated XP dotNetFx AIO
     
  15. abbodi1406

    abbodi1406 MDL KB0000001

    Feb 19, 2011
    16,226
    84,921
    340
    W10UI v5.2

    - Changed: image cleanup does not occur if you only integrated Servicing Stack Update
    now it should
     
  16. zennon

    zennon MDL Novice

    Sep 22, 2016
    20
    28
    0
    #416 zennon, Aug 23, 2018
    Last edited: Aug 26, 2018
    Dear abbodi1406!
    Thank you so much for your great work! :)
     
  17. shekarsiripalli

    shekarsiripalli MDL Novice

    Aug 21, 2015
    8
    0
    0
    Unable to Activate Msoffice
    ==============================
    first tried to Uninstall all the Activators by installing and Uninstalling one by one.
    Rebooted My Pc, And tried to Activate Using "KMS_VL_ALL-SppExtComObjPatcher-kms-25", By following Readme text file.
    Did not got activated , So i Uninstalled office using "o15-ctrremove" file and Reinstalled But No success.
    and Made changes to "KMS_VL_ALL" by updating "set _Debug=1" , below is the log file.....

    ===========================================================================
    Running in Debug Mode...
    The window will be closed when finished

    >set KMS_Emulation=1

    >set KMS_ActivationInterval=43200

    >set KMS_RenewalInterval=43200

    >set Windows=Random

    >set Office2010=Random

    >set Office2013=Random

    >set KMS_IP=172.16.0.2

    >set KMS_Port=1688

    >color 1F

    >title KMS_VL_ALL Manual

    >setlocal EnableExtensions EnableDelayedExpansion

    >cd /d "C:\Users\Shekar\Downloads\KMS_VL_ALL-SppExtComObjPatcher-kms-25\SppExtComObjPatcher-kms2\"

    >IF /I "AMD64" EQU "AMD64" (set xOS=x64 ) else (set xOS=Win32 )

    >set "IFEO=HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options"

    >set "OSPP=HKLM\SOFTWARE\Microsoft\OfficeSoftwareProtectionPlatform"

    >set "SPPk=SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform"

    >wmic path SoftwareLicensingProduct where (Description like '%KMSCLIENT%') get Name 2>nul | findstr /i Windows 1>nul && (set SppHook=1 ) || (set SppHook=0 )

    >wmic path OfficeSoftwareProtectionService get Version && (set OsppHook=1 ) || (set OsppHook=0 )
    Node - SHEKAR-PC

    ERROR:

    Description = Access is denied.




    >for /F "tokens=6 delims=[]. " %G in ('ver') do set winbuild=%G

    >set winbuild=7601

    >if 7601 GEQ 9200 (set OSType=Win8 ) else if 7601 GEQ 7600 (set OSType=Win7 ) else (goto :UnsupportedVersion )

    >if 7601 GEQ 9600 (reg.exe add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\CurrentVersion\Software Protection Platform" /v NoGenTicket /t REG_DWORD /d 1 /f )

    >if 7601 LSS 9200 set win7=1

    >if 7601 LSS 14393 goto :Main

    >call :StopService sppsvc

    >sc query sppsvc | find /i "STOPPED" || net stop sppsvc /y
    The Software Protection service is stopping.
    The Software Protection service was stopped successfully.


    >sc query sppsvc | find /i "STOPPED" || sc stop sppsvc
    STATE : 1 STOPPED

    >goto :eof

    >if 0 NEQ 0 call :StopService osppsvc

    >set AclReset=0

    >for %A in ("x64\SppExtComObjHook.dll") do set "PatcherPath=%~fA"

    >set "PatcherPath=C:\Users\Shekar\Downloads\KMS_VL_ALL-SppExtComObjPatcher-kms-25\SppExtComObjPatcher-kms2\x64\SppExtComObjHook.dll"

    >mklink "C:\Windows\system32\SppExtComObjHook.dll" "C:\Users\Shekar\Downloads\KMS_VL_ALL-SppExtComObjPatcher-kms-25\SppExtComObjPatcher-kms2\x64\SppExtComObjHook.dll"
    Cannot create a file when that file already exists.

    >icacls "C:\Windows\system32\SppExtComObjHook.dll" /findsid *S-1-5-32-545 | find /i "SppExtComObjHook.dll" || (
    set AclReset=1
    icacls "C:\Windows\system32\SppExtComObjHook.dll" /grant *S-1-5-32-545:RX
    )
    SID Found: C:\Windows\system32\SppExtComObjHook.dll.

    >if Win7 EQU Win8 call :CreateIFEOEntry SppExtComObj.exe

    >if Win7 EQU Win7 if 0 NEQ 0 call :CreateIFEOEntry sppsvc.exe

    >if 0 NEQ 0 call :CreateIFEOEntry osppsvc.exe

    >for %A in (14 15 16) do call :eek:fficeLoc %A

    >call :eek:fficeLoc 14

    >set loc_off14=0

    >for /F "tokens=2*" %a in ('"reg query HKLM\SOFTWARE\Microsoft\Office\14.0\Common\InstallRoot /v Path" ') do if exist "%b\OSPP.VBS" set loc_off14=1
    ERROR: The system was unable to find the specified registry key or value.

    >for /F "tokens=2*" %a in ('"reg query HKLM\SOFTWARE\Wow6432Node\Microsoft\Office\14.0\Common\InstallRoot /v Path" ') do if exist "%b\OSPP.VBS" set loc_off14=1
    ERROR: The system was unable to find the specified registry key or value.

    >if exist "C:\Program Files\Microsoft Office\Office14\OSPP.VBS" set loc_off14=1

    >if exist "C:\Program Files (x86)\Microsoft Office\Office14\OSPP.VBS" set loc_off14=1

    >exit /b

    >call :eek:fficeLoc 15

    >set loc_off15=0

    >for /F "tokens=2*" %a in ('"reg query HKLM\SOFTWARE\Microsoft\Office\15.0\Common\InstallRoot /v Path" ') do if exist "%b\OSPP.VBS" set loc_off15=1
    ERROR: The system was unable to find the specified registry key or value.

    >for /F "tokens=2*" %a in ('"reg query HKLM\SOFTWARE\Wow6432Node\Microsoft\Office\15.0\Common\InstallRoot /v Path" ') do if exist "%b\OSPP.VBS" set loc_off15=1
    ERROR: The system was unable to find the specified registry key or value.

    >if exist "C:\Program Files\Microsoft Office\Office15\OSPP.VBS" set loc_off15=1

    >if exist "C:\Program Files (x86)\Microsoft Office\Office15\OSPP.VBS" set loc_off15=1

    >exit /b

    >call :eek:fficeLoc 16

    >set loc_off16=0

    >for /F "tokens=2*" %a in ('"reg query HKLM\SOFTWARE\Microsoft\Office\16.0\Common\InstallRoot /v Path" ') do if exist "%b\OSPP.VBS" set loc_off16=1
    ERROR: The system was unable to find the specified registry key or value.

    >for /F "tokens=2*" %a in ('"reg query HKLM\SOFTWARE\Wow6432Node\Microsoft\Office\16.0\Common\InstallRoot /v Path" ') do if exist "%b\OSPP.VBS" set loc_off16=1

    >if exist "C:\Program Files (x86)\Microsoft Office\Office16\\OSPP.VBS" set loc_off16=1

    >if exist "C:\Program Files\Microsoft Office\Office16\OSPP.VBS" set loc_off16=1

    >if exist "C:\Program Files (x86)\Microsoft Office\Office16\OSPP.VBS" set loc_off16=1

    >exit /b

    >call :SPP

    >reg delete "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\55c92734-d682-4d71-983e-d6ec3f16059f" /f
    ERROR: The system was unable to find the specified registry key or value.

    >reg delete "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\0ff1ce15-a989-479d-af46-f275c6370663" /f
    ERROR: The system was unable to find the specified registry key or value.

    >set spp=SoftwareLicensingProduct

    >set sps=SoftwareLicensingService

    >if 0 EQU 0 if 1 EQU 0 (set "aword=No Installed" ) else (set "aword=No Supported KMS Client" )

    >wmic path SoftwareLicensingProduct where (Description like '%KMSCLIENT%') get Name | findstr /i Office && (set office15=1 ) || (if not defined win7 echo. & echo No Supported KMS Client Office 2013/2016/2019 Product Detected... )
    No Instance(s) Available.


    >wmic path SoftwareLicensingProduct where (Description like '%KMSCLIENT%') get Name | findstr /i Windows && (set WinVL=1 ) || (echo. & echo No Supported KMS Client Windows Detected... )
    No Instance(s) Available.


    No Supported KMS Client Windows Detected...

    >if not defined office15 if not defined WinVL exit /b

    >call :OSPP

    >reg delete "HKLM\SOFTWARE\Microsoft\OfficeSoftwareProtectionPlatform\59a52881-a989-479d-af46-f275c6370663" /f
    ERROR: The system was unable to find the specified registry key or value.

    >reg delete "HKLM\SOFTWARE\Microsoft\OfficeSoftwareProtectionPlatform\0ff1ce15-a989-479d-af46-f275c6370663" /f
    ERROR: The system was unable to find the specified registry key or value.

    >set spp=OfficeSoftwareProtectionProduct

    >set sps=OfficeSoftwareProtectionService

    >if defined win7 (set "aword=2010/2013/2016/2019" ) else (set "aword=2010" )

    >wmic path OfficeSoftwareProtectionService get Version || (echo. & echo No Installed Office 2010/2013/2016/2019 Product Detected... & exit /b )
    Node - SHEKAR-PC

    ERROR:

    Description = Access is denied.




    No Installed Office 2010/2013/2016/2019 Product Detected...

    >del /f /q "x64\sppchk.txt"
    Could Not Find C:\Users\Shekar\Downloads\KMS_VL_ALL-SppExtComObjPatcher-kms-25\SppExtComObjPatcher-kms2\x64\sppchk.txt

    >del /f /q "x64\osppchk.txt"
    Could Not Find C:\Users\Shekar\Downloads\KMS_VL_ALL-SppExtComObjPatcher-kms-25\SppExtComObjPatcher-kms2\x64\osppchk.txt

    >call :StopService sppsvc

    >sc query sppsvc | find /i "STOPPED" || net stop sppsvc /y
    The Software Protection service is stopping.
    The Software Protection service was stopped successfully.


    >sc query sppsvc | find /i "STOPPED" || sc stop sppsvc
    STATE : 1 STOPPED

    >goto :eof

    >if 0 NEQ 0 call :StopService osppsvc

    >if 0 == 1 (icacls "C:\Windows\system32\SppExtComObjHook.dll" /reset )

    >if exist "C:\Windows\system32\SppExtComObjHook.dll" del /f /q "C:\Windows\system32\SppExtComObjHook.dll"

    >if exist "C:\Windows\system32\SppExtComObjPatcher.dll" del /f /q "C:\Windows\system32\SppExtComObjPatcher.dll"

    >if exist "C:\Windows\system32\SppExtComObjPatcher.exe" del /f /q "C:\Windows\system32\SppExtComObjPatcher.exe"

    >if Win7 EQU Win8 call :RemoveIFEOEntry SppExtComObj.exe

    >if Win7 EQU Win7 if 0 NEQ 0 call :RemoveIFEOEntry sppsvc.exe

    >if 0 NEQ 0 call :RemoveIFEOEntry osppsvc.exe

    >sc start sppsvc trigger=timer;sessionid=0

    SERVICE_NAME: sppsvc
    TYPE : 10 WIN32_OWN_PROCESS
    STATE : 2 START_PENDING
    (NOT_STOPPABLE, NOT_PAUSABLE, IGNORES_SHUTDOWN)
    WIN32_EXIT_CODE : 0 (0x0)
    SERVICE_EXIT_CODE : 0 (0x0)
    CHECKPOINT : 0x1
    WAIT_HINT : 0x4e20
    PID : 4680
    FLAGS :

    >echo.


    >echo.


    >echo Press any key to exit...
    Press any key to exit...

    >if 1 EQU 0 pause 1>nul

    >exit
     
  18. adric

    adric MDL Expert

    Jul 30, 2009
    1,255
    1,327
    60
    #418 adric, Aug 30, 2018
    Last edited: Aug 31, 2018
    When I do a fresh LTSB 2016 offline build, I never get the WinPE resetting message even though a /resetbase is performed. The echo entries were added by me to see which dism cmd was being issued. This is what I'm seeing:
    Code:
    "u:\$W0\ADK_6\amd64\DISM\dism.exe" /image:"d:\W10UImountre" /Cleanup-Image /StartComponentCleanup /ResetBase
    errorlevel 0
    Code with echos
    Code:
    :cleanup
    if exist "%mumtarget%\sources\recovery\RecEnv.exe" (
    if %verb%==1 (
    echo.
    echo ============================================================
    echo Resetting WinPE image base
    echo ============================================================
    )
    if "%build%" geq "16299" (
    echo "%build%"
    set ksub=SOFTWIM
    %_reg% load HKLM\!ksub! "%mumtarget%\Windows\System32\Config\SOFTWARE" >nul
    %_reg% add HKLM\!ksub!\Microsoft\Windows\CurrentVersion\SideBySide\Configuration
    %_reg% unload HKLM\!ksub! >nul
    echo "%dismroot%" %dismtarget% /Cleanup-Image /StartComponentCleanup
    "%dismroot%" %dismtarget% /Cleanup-Image /StartComponentCleanup
    echo errorlevel !errorlevel!
    if !errorlevel! equ 1726 "%dismroot%" %dismtarget% /Get-Packages >nul
    )
    echo "%dismroot%" %dismtarget% /Cleanup-Image /StartComponentCleanup /ResetBase
    "%dismroot%" %dismtarget% /Cleanup-Image /StartComponentCleanup /ResetBase
    echo errorlevel !errorlevel!
    if !errorlevel! equ 1726 "%dismroot%" %dismtarget% /Get-Packages >nul
    call :cleanupmanual
    goto :eof
    )
     
  19. abbodi1406

    abbodi1406 MDL KB0000001

    Feb 19, 2011
    16,226
    84,921
    340
    Messages for WinRE are deliberately disabled for better readabilty (i.e. not to interfere with install.wim updating messages)

    so you only get "Updating winre.wim" :)
     
  20. abbodi1406

    abbodi1406 MDL KB0000001

    Feb 19, 2011
    16,226
    84,921
    340
    @shekarsiripalli

    run 1-SppExtComObjPatcher.cmd to install first (don't activate)
    then run it again to remove it

    now run KMS_VL_ALL.cmd in debug mode