Windows 10 installation ejecting USB drive after 1st restart. How to prevent this?

haseakash

New Member
Problem :
in setupcomplete.cmd

i added some scripts that launches exe from windows installation media pendrive source
it says no usb found. (installation drive).

2nd imp point .. I want to launch some files from the installation media pendrive only when the user sees the 1st desktop.

Notice:
I truly noticed that , windows 10 installation is self ejecting itself (installation media pendrive) after 1st restart. After [installing windows files 100% complete] .
or 2nd restart before setupcomeplete starts

Tests:
script says drive not found. also tested with startup commands. It also can't detect the installation drive after I see the 1st desktop.
Also, I cant see my installation pendrive after clean windows @ 1st user desktop.
nowhere it shows (in device managers, diskpart, windows explorer nowhere it shows. also there is no yellow sign in device manager).
i also start diskpart in setupcomeplete there is no drive or volume that contains windows setup installation /usb drive.

manual solution1:
if i simply plug and unplug installation pendrive.then it shows in explorer..

manual solution2:
One more thing.. if i use the second pendrive while installing then it detects the 2nd pendrive
(@setupcomple @ startup batch @ i see 1st desktop.)
then 1 st desktop I only see my 2nd pendrive. not windows installation pendrive.


I Want automatic solution without using two pen drives or using another drive.
Question:

is there any feature in ntlite to prevent self ejecting windows drive while installing windows???

or give me any script to replug installation media automatically.
any batch cmd or c,c# code

Please, this is the vip thing I'm facing.

I just want to load files from usb drive only (installation media drive) and dont want to use two pen drives or manually putting it back while setupcomplete starts.
i dont want to replug it throgh pid name or hardware id. becuase i uses random pendrives..

Thanks alot for past help !!!!!!!!!!!!
 
Last edited:
can you share your setupcomplete.cmd i assume there is a problem in there? or did you remove any drivers via ntlite share your preset too.
 
ege914 : My setupcomplete cmd is contains only
Start wait cmd.exe command. At 1st line

I test it removing all script and just added 1 line to start cmd. (for check removable drive is showing or not?.


I'm 100% sure its not setupcomplete.cmd fault.

Also, my ntlite steps:

1) Downloaded 21H1 latest iso official using media creation tool.

2) extracted using 7z

3) add that source to ntlite

4) removed home, pro n, enterprise, student and n edition.

Just contains windows 10 x64 Pro.

I don't removed boot wim.
There is 2 boot.


5) converted esd to wim ntlite

6) loaded.

7) just add a cmd exe in post command.
start wait command. Which works.

8) default unattended selected

9) Saved iso.

10) made a bootable usb by Rufus.

Using sandisk 16gb 3.0 pendrive.

11) booted amd ryzen5 3600, msi b450m pro-vdh max motherboard.

12) usb is placing front usb 3.0 port of motherboard.




I test same usb with 2.0 port.backside and front also.
I test same usb with 3 different laptops
But problem is same.

Usb is not detecting when or before setupcomplete.cmd starts.
In diskpart.

Also 1 more vip thing u have to know:

Windows 7 and windows 8 setups does not have this problem. Im facing this problem with windows 10 only.

In win 7 and 8 i can see my same usb drive in setupcomplete.cmd.

So its clearly proves that my USB/MOBO/Usb 3.0 port does not have any problem.
Also all os are official of Microsoft site
No third party download.

Im facing problem with only in windows 10.

I test 1909,20H2,21H1 but problem is same.
Old os 7 and 8 does not have this problem.

And official os manual installation is not ejecting usb drive. I can see installation usb pendrive when i see 1st desktop.

So its ntlite related.


I dont add or removed any features in ntlite.
Dont removed any drivers or adds.
Nothing changed while making iso.

Just plain default unattended with post setup start wait cmd.exe

Help......

U can test 21h1 with pro edition only.
Add start wait cmd in post setup.
. Just make unattend default.
And launch cmd when setupcomplete.cmd start
Diskpart >list disk. U will notice there is no Removable drive
 
Last edited:
Clanger : im glad for ur advice bro. Thank u so much from <3. ur telling me to save files in $OEM folder. but my driverpack is 25gb and i have multiboot hdd.
so i cant put it in every $Oem.
 
upload the requested files so any problems can be seen and possibly rectified. just saying it has 1 line or whatever doesnt exactly help.
 
i don't think nuhi fixed anything related to this issue in this update... it may be pure luck and your problem can back. just saying
 
Taosd : Here is test setupcomplete. i test it also removing del commands.

But im telling u its not related setupcomplete.


Its related when 2nd restart happnes then setucomplete launches. between this something is disconnecting USB drive.


ege914 : Only this guy knows what is wrong with me. bcoz he also face this problem. because our purpouse is launching an exe from same installation drive/USB Drive. and dont want to place it in $Oem due to size matters and when if u have mutiple os.

We want to launch that exe from same usb drive (installation USB:\Driverpack\customstartup.exe) @1st startup without copying whole big size Driverpack folder to $Oem.


IMG_20210812_220214__01.jpg
 
Last edited:
dude, if i were you i would test official iso many times to see if it is randomly happening. because it worked and not worked with custom iso randomly as you experienced.


if this is happening on official untouched vanilla iso too. (and i expect this to happen on vanilla too) then we can say that "it is about windows or hardware"

then you need some alternative solution than fixing this bug. if you believe that restarting at oobe then launching setupcomplete.cmd will fix your issue then why don't you just restart in oobe.cmd?
 
ege914 : 1st i had formatted my pc more than 20,000 times with custom iso and official too.

As i know, As my tests,
Official ms iso dont have any problem.
I always see USB drive when 1st desktop appears.

I created win 7, 8,10 different iso with same settings. And perfect unattended file.

I didn't add any drivers or modified anything of os.


Just added post setup and unattended file.



So, from test,
There is no issue for win7 and win8.1 builds.

Issue is only for Win 10.
And i used ntlite for this.


2nd : You r right. Why shouldn't i restart pc un oobe?
I did that test yesterday.

But see the sequence here,
Win setup starts>100%files>1st restart done
>machine started>im seeing only rotating dots with windows logo with getting ready
(as i know here our custom files are copied to windir from pendrive to internal hdd/ssd)
> OOBE cmd starts (i launched cmd here. And tried for Restart. But it is says. There is restart request already pending. It wont let me restart. from cmd. (restart already pending) I exited cmd.
> Then 2nd restart happens.
>Now setupcomplete.cmd starts.
And not showing USB in diskpart from cmd

:(

So nuhi have to do this thing.

I never saw problem for win7and8.
So we need solution for this.

Im writing here everyday bcoz my project is going on. And it uses only 1 drive. I dont want two usb and dont want to unplug and plug it again.

And last thing:
I dont belive this hardware related. Bcoz i tested same pendrive with different laptops. Same problem.

Its started after when our files copied to windir from pendrive to hdd. (here files copied so usb works here) and then oobe started then 2nd restart and then setupcomplete.


Oobe cmd also dont showing USB.
Im totally mentally harassed - _-
Or give me automatic alternative solution.

Is there any technology available for spilt setupcomplete.cmd into two parts?
Oobe runs before setupcomplete.

But Oobe starts and then restarting pc and then setupcomplete.cmd starts.

I want to start setupcomplete.cmd and restart and then resume to next command.
Microsoft says it not possible.
I checked everywhere. Also test with run synchronous commands add 1 and and 2.
But it is not working.


Something very strange thing here.. :(
 
Last edited:
ege914 : 1st i had formatted my pc more than 20,000 times with custom iso and official too.

As i know, As my tests,
Official ms iso dont have any problem.
I always see USB drive when 1st desktop appears.

I created win 7, 8,10 different iso with same settings. And perfect unattended file.

I didn't add any drivers or modified anything of os.


Just added post setup and unattended file.



So, from test,
There is no issue for win7 and win8.1 builds.

Issue is only for Win 10.
And i used ntlite for this.


2nd : You r right. Why shouldn't i restart pc un oobe?
I did that test yesterday.
But see the sequence here,
Win setup starts>100%files>1st restart done
>machine started>im seeing only rotating dots with windows logo with getting ready
(as i know here our custom files are copied to windir from pendrive to internal hdd/ssd)
> OOBE cmd starts (i launched cmd here. And tried for Restart. But it is says. There is restart request already pending. It wont restart from cmd. I exited cmd
> Then 2nd restart happens.
>Now setupcomplete.cmd starts.
And not showing USB in diskpart from cmd

:(

So nuhi have to do this thing.

I never saw problem for win7and8.
So we need solution for this.

Im writing here everyday bcoz my project is going on. And it uses only 1 drive. I dont want two usb and dont want to unplug and plug it again.

And last thing:
I dont belive this hardware related. Bcoz i tested same pendrive with different laptops. Same problem.

Its started after when our files copied to windir from pendrive to hdd. (here files copied so usb works here) and then oobe started then 2nd restart and then setupcomplete.

Something very strange thing here..

Oobe cmd also dont showing USB.

Problem is when after 1st restart>custom files copied 100%>Oobe cmd start>2nd restart>setupcomplete.cmd start

At this marked thing having problem with usb.

Is there any technology available that i can spilt setupcomplete.cmd into two parts. 1 for restart and 2nd will start after restart before desktop appears?

I searched everywhere. As Microsoft says only 1 setupcomplete.cmd works.

I also tests Run synchronous commands.
I adds 1 and 2 in unattended file.
But it doesn't working. I added perfect without error. But 1st custom cmd not launched. Only setupcomplete works.


Restarting Setupcomplete.cmd and resuming it will solve this problem. But how?.

Im mentally harassed

Im assuming its OOBE related problem or reg or driver.
 
Last edited:
ege914 : 1st i had formatted my pc more than 20,000 times with custom iso and official too.

As i know, As my tests,
Official ms iso dont have any problem.
I always see USB drive when 1st desktop appears.

I created win 7, 8,10 different iso with same settings. And perfect unattended file.

I didn't add any drivers or modified anything of os.


Just added post setup and unattended file.



So, from test,
There is no issue for win7 and win8.1 builds.

Issue is only for Win 10.
And i used ntlite for this.


2nd : You r right. Why shouldn't i restart pc un oobe?
I did that test yesterday.
But see the sequence here,
Win setup starts>100%files>1st restart done
>machine started>im seeing only rotating dots with windows logo with getting ready
(as i know here our custom files are copied to windir from pendrive to internal hdd/ssd)
> OOBE cmd starts (i launched cmd here. And tried for Restart. But it is says. There is restart request already pending. It wont restart from cmd. I exited cmd
> Then 2nd restart happens.
>Now setupcomplete.cmd starts.
And not showing USB in diskpart from cmd

:(

So nuhi have to do this thing.

I never saw problem for win7and8.
So we need solution for this.

Im writing here everyday bcoz my project is going on. And it uses only 1 drive. I dont want two usb and dont want to unplug and plug it again.

And last thing:
I dont belive this hardware related. Bcoz i tested same pendrive with different laptops. Same problem.

Its started after when our files copied to windir from pendrive to hdd. (here files copied so usb works here) and then oobe started then 2nd restart and then setupcomplete.

Something very strange thing here..

Oobe cmd also dont showing USB.

Problem is when after 1st restart>custom files copied 100%>Oobe cmd start>2nd restart>setupcomplete.cmd start

At this marked thing having problem with usb.

Is there any technology available that i can spilt setupcomplete.cmd into two parts. 1 for restart and 2nd will start after restart before desktop appears?

I searched everywhere. As Microsoft says only 1 setupcomplete.cmd works.

I also tests Run synchronous commands.
I adds 1 and 2 in unattended file.
But it doesn't working. I added perfect without error. But 1st custom cmd not launched. Only setupcomplete works.


Restarting Setupcomplete.cmd and resuming it will solve this problem. But how?.

Im mentally harassed

Im assuming its OOBE related problem or reg or driver.
you must have one hell of a hard drive to survive 20,000 formats
 
share your exact preset, oem folder and unattended file so i can test myself. stop saying there is nothing bla bla bla. just send them. you are wasting our time by not letting us test.
 
Finally, i solved this... 100% working. :)

ege914 nuhi Clanger

I want to tell all of you... i found a real problem for this bug.

Ege914 was right it was between usb and motherboard.
Driver was the problem.

solution is here :
https://www.win-raid.com/t834f25-USB-Drivers-original-and-modded.html

1) I selected and downloaded original drivers only. mounted with boot and install.wim both.

2) checked 5 times.. it works.. Yes usb is there.

So in this site we have to download all usb colleaction and mount with both boot and wim

In technical,

Our USB 3.1/3.0 was works in windows setup but before setupcomplete and after not works.

means here Sysprep done and removed all. i tested with
<DoNotCleanUpNonPresentDevices>true</DoNotCleanUpNonPresentDevices>
<PersistAllDeviceInstalls>true</PersistAllDeviceInstalls>

BUT this not works.





Final Working Solution For All :


Just download all USB Drivers and inject them into boot and install wim.

Problem Solved :)

ege914 - Im 100% sure you will never see this problem again . You need Intel,Amd etc all of usb drivers. ::cool:
 
Last edited:
don't need to since uupdump integrates basic drivers? or i can be wrong i don't know....

btw i think if you use usb2.0 on usb2.0 port you will not experience these issues.
but you can use usb 3.1/3.0 on newest motherboards. there won't be problem...

i'm glad you solved the issue since i will not integrate any drivers to my iso. i can just plug out and in just to be sure :)
 
Back
Top