I created a SetupComplete.cmd file that removes DefaultUser0 profile and it is placed in Windows\Setups\Scripts folder. With build 1703 this file automatically does what it was meant to do and removes DefaultUser0 profile. With build 1607 - it does not (and DefaultUser0 folder remains), but it works fine when launched manually. Why is that? I would also like to integrate KMS_VL_ALL as part of Post-Setup process, which requires placement the $OEM$ folder in Sources directory on the ISO, but it also uses SetupComplete.cmd. Is it possible to make both Post-Setup work as they should - SetupComplete.cmd in Windows\Setup\Scripts directory AND SetupComplete.cmd in $OEM$ folder inside the ISO? Note: SetupComplete.cmd in Scripts folder does not apply in build 1607 even when $OEM$ is not used / not placed in Sources folder on the ISO. However, I think both SetupComplete.cmd files apply in build 1703. This is the contents of the CMD file: Spoiler: SetupComplete.cmd SET UserToRemove="defaultuser0" REM 'CALL' check registry subroutine check for existance and remove. FOR /f "tokens=*" %%a IN ('REG query "HKLM\Software\Microsoft\Windows NT\CurrentVersion\ProfileList"^|find /i "s-1-5-21"') DO CALL :ChkRegistry "%%a" GOTO :Finish :ChkRegistry REM ----------------------------------------------------------------------- REM Results of ERRORLEVEL are: REM 0 -- If UserToRemove is found in the registry then run rest of script. REM 1 -- If UserToRemove is NOT found in the registry then exit script. REM ----------------------------------------------------------------------- FOR /f "tokens=3" %%g in ('reg query %1 /v ProfileImagePath') DO SET UserProfilePath=%%g FOR /f "tokens=3 delims=\" %%e in ('echo %UserProfilePath%') DO SET ProfileName=%%e FOR /f "tokens=1 delims=." %%f IN ('echo %ProfileName%') DO SET ParseRegistry=%%f ECHO %UserToRemove%|find /I "%ParseRegistry%" > NUL IF ERRORLEVEL=1 GOTO :Finish REM Remove that user... RMDIR "%SystemDrive%\Users\%ProfileName%" /s /q REG delete %1 /f >nul IF EXIST "%SystemDrive%\Users\%ProfileName%" GOTO :RetryDirRemove GOTO :Finish :RetryDirRemove TAKEOWN /F "%ProfileName%" >nul TIMEOUT /T 2 >nul ICACLS "%ProfileName%" /GRANT *S-1-1-0:F >nul TIMEOUT /T 2 >nul RMDIR "%SystemDrive%\Users\%ProfileName%" /s /q :Finish REM End of script...
It doesn't matter if it is in the $OEM$ folder or in the install.wim\windows\setup\scripts folder. The setupcomplete should simply work on all win 10 but the script is not always able to fix the problem, that's why some build in extra lines to complete it.
Thank you for the information, but unfortunately, it does not help me one bit... I still don't know how to make it work for 1607 build and still don't know how to combine both of SetupComplete.cmd properly.
Yes, it is true. I have read its readme.txt file There mention : Attempts to remove defaultuser0 and the correct UserID registry entry. (Windows 10 / Server 2016) Like the wishes of MonarchX
Maybe your using an OEM key with 1607. If so it will skip setupcomplete.cmd. You can merge each batch or just rename them & use the call function: Code: Call remove_default0.cmd Call VL_Activate.cmd
What makes no sense. the fact MRP does the job you need to be done on all windows sku's imaginable, including Insider Previews?