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:

haseakash

New Member
no way to prevent it as far as i know.
try putting your files/folders into the $OEM$ folders, source x:\ x:\ being your usb drive, so x:\source\$OEM$\$1 , $1 being the root of you install partition.
bro u still dident understand my problem , i want to launch some files from same installation drive after user see 1st desktop. at that time there is no usb drive found in explorer,device manager or diskpart. i know everything about $Oem.
just read my question carefully.
 

crypticus

Well-Known Member
Actually i experienced this randomly... the commands didn't run because the necessary files were not there.. this caused by random usb ejects.... i wonder if there is a way to fix this problem.

btw setupcomplete runs perfectly, your problem is not that. your problem is the runonce commands you use (like me) which they install exe files on the usb on my end (but they cant be found because usb is ejected)
 

crypticus

Well-Known Member
I don't think this is ntlite's fault... it happens to me randomly at different laptops. so i assume this is not about windows either. it should be about usb drive and motherboards.... so the only way i can think of is making windows rescan plugged usb drives.

to achieve that we can add a runonce command to scan them command can be "PnPUtil /scan-devices"
to add it to runonce use this command
REG ADD "HKLM\Software\Microsoft\Windows\CurrentVersion\RunOnce" /v "ReScanDevices" /d "C:\Windows\System32\cmd.exe /min /c PnPUtil /scan-devices" /f

check if works... thats all i can do.
 

haseakash

New Member
ege914 : i launched device manager in setupcomplete.

no need PnPUtil/scan-devices.

i rescan it through device manager>Action>Scan for hardware changes before desktop apperes.



USB not showing in disk drives,ports, usb serial bus controller there is NO USB exist.

But, i check Device Manager>View>Show hidden devices..

there is white box with usb connected drive. i know it is showing last connected drive. But how??? I dont touched usb.

if desktop apperes then it still not able to see anywhere in windows.
but after completing full install of windows (user see 1st desktop)
then if i restart pc then it automatically get back.


Here is test image :

Check this :


https://drive.google.com/file/d/1iDCVVHzgEXimG12I1HnyPrGtR4tteaqF/view?usp=sharing


ALSO, i test with different laptop with different usb chipset. still same problem. windows is 20H2 official
 

crypticus

Well-Known Member
then you may try disabling and reenabling that drive? if it fixes the issue it can also be done via cmd. so test it pls
 
Last edited:

crypticus

Well-Known Member
ege914 it isnt ntlites fault. this happens on windows 7 too. normal windows behaviour.
"I don't think this is ntlite's fault... it happens to me randomly at different laptops. so i assume this is not about windows either. it should be about usb drive and motherboards.... so the only way i can think of is making windows rescan plugged usb drives."
 

Clanger

Moderator
Staff member
haseakash
i understood your problem perfectly and i gave you a solution, did you even try it?
if you dont want to take my advice thats your problem.
 
Last edited:

Clanger

Moderator
Staff member
ege914 i think its just the way windows handles removable drives. adding stuff to setupcomplete/setup/files is the best option.
 

crypticus

Well-Known Member
ege914 i think its just the way windows handles removable drives. adding stuff to setupcomplete/setup/files is the best option.
no it can't be since it is random. if it was about windows it wouldn't be random. its hardware related. windows never ejects usb drives by its own.
 

Clanger

Moderator
Staff member
no matter where the cause lay the best and most reliable way around is use $OEM$.
you can spend hours trying to work out the reason why or find a workaround then call it a day.
 

crypticus

Well-Known Member
i don't mind unpluging and pluging my usb back to the computer but i don't like your solution

if you are installing tons of unattended exe files. and customize them by each computer. opening iso file via 7zip and placing it inside setup folder is not a great solution. and if its esd compressed its not possible at all..

+i don't like my oem folder on the usb's root. it just looks ugly and easy going... i just have software folder which contains unattended setups
 

haseakash

New Member
Clanger : Bro thank for tip. But.. u should unterstand me first. Im NOT a noob which dont know $Oem.

i have my Usb SSD Drive. which having Universal driverpack for any pc. which is 1 click.

i want to launch that driverpack exe from same disk (Windows Setup/Windows installation usb drive) when user see 1st desktop/startup.


So problem is, After unattended install. when user see 1st desktop. my batch is starting to find that driverpack exe.
(I saved full driverpack folder in same win setup installation drive/removable usb drive)
that time i there is no usb drive detected. nowhere in device manager, diskpart, etc.
so it failed.
i cant put whole driverpack within oem folder bcoz Driverpack is about 25gb size. i dont want to increase windows setup size more than 16gb (for some reason)

bcaz i used more than 1 winodws from 1 disk.
also i dot want to make All In one single setup.(really)
i created different/indipendant windows with menu for selecting.
my driverpack is single for all os.
so i cannot use it in every oem folder.



So my driverpack is placing in same usb drive

i just want to launch driverpack when user see 1st desktop.
also i dont want to use another drive for driverpack (which works)
also my startup script is working perfectly with finding all drives.

But here is problem.... disk is not detected when user see 1st desktop.
if i just restart pc or unplug and plug it back then it works.
THIS IS A PROBLEM.
i dont want manual solution.
and dont want to use TWO usb drives.

I hope u fully understand my problem.... :(


ege914: disk already totally disconnected. can not able to see disable enable. It is same when u
plug an usb to pc>unplug it>device manager>view>show hidden devices>usb drive with error 45

Currently, this hardware device is not connected to the computer. (Code 45)
To fix this problem, reconnect this hardware device to the computer.

means hadware is already disconnected.



Anybody expert here??? for give me last working solution? :(

i also test RestartSrDev software
which used when we click safely remove from windows. this work for get back again with command line RestartSrDev *.

but it is not working for my Case.


And final imp thing u have to know,

i used regular official 20H2 setup. for manual install.
it does not disconnected drive.
i can see (windows installation drive) when user see 1st desktop.

i assume that definetly its NTlife fault. Official windows os does not have that problem. i created ntlite iso using same original official iso . (Properly without modifilying any internal things. just added setupcomplete. also with latest ntlite)

Any reg that is ejecting usb at 2nd restart where custom exe files are copied into windir
before setupcomeplete starts.
something is disconnecting that drive.
i also test another iso with another usb drive. same problem.


Regards,
Aakash Hase,
SkyWorld computers and 3D Gaming Playstation,
India.
 
Last edited:

Taosd

Active Member
Clanger : Bro thank for tip. But.. u should unterstand me first. Im NOT a noob which dont know $Oem.

i have my Usb SSD Drive. which having Universal driverpack for any pc. which is 1 click.

i want to launch that driverpack exe from same disk (Windows Setup/Windows installation usb drive) when user see 1st desktop/startup.


So problem is, After unattended install. when user see 1st desktop. my batch is starting to find that driverpack exe.
(I saved full driverpack folder in same win setup installation drive/removable usb drive)
that time i there is no usb drive detected. nowhere in device manager, diskpart, etc.
so it failed.
i cant put whole driverpack within oem folder bcoz Driverpack is about 25gb size. i dont want to increase windows setup size more than 16gb (for some reason)

bcaz i used more than 1 winodws from 1 disk.
also i dot want to make All In one single setup.(really)
i created different/indipendant windows with menu for selecting.
my driverpack is single for all os.
so i cannot use it in every oem folder.



So my driverpack is placing in same usb drive

i just want to launch driverpack when user see 1st desktop.
also i dont want to use another drive for driverpack (which works)
also my startup script is working perfectly with finding all drives.

But here is problem.... disk is not detected when user see 1st desktop.
if i just restart pc or unplug and plug it back then it works.
THIS IS A PROBLEM.
i dont want manual solution.
and dont want to use TWO usb drives.

I hope u fully understand my problem.... :(


ege914: disk already totally disconnected. can not able to see disable enable. It is same when u
plug an usb to pc>unplug it>device manager>view>show hidden devices>usb drive with error 45

Currently, this hardware device is not connected to the computer. (Code 45)
To fix this problem, reconnect this hardware device to the computer.

means hadware is already disconnected.



Anybody expert here??? for give me last working solution? :(

i also test RestartSrDev software
which used when we click safely remove from windows. this work for get back again with command line RestartSrDev *.

but it is not working for my Case.


And final imp thing u have to know,

i used regular official 20H2 setup. for manual install.
it does not disconnected drive.
i can see (windows installation drive) when user see 1st desktop.

i assume that definetly its NTlife fault. Official windows os does not have that problem. i created ntlite iso using same original official iso . (Properly without modifilying any internal things. just added setupcomplete. also with latest ntlite)

Any reg that is ejecting usb at 2nd restart where custom exe files are copied into windir
before setupcomeplete starts.
something is disconnecting that drive.
i also test another iso with another usb drive. same problem.


Regards,
Aakash Hase,
SkyWorld computers and 3D Gaming Playstation,
India.
personally, i think its USERS fault for incorrectly assuming the tools being used are the wrong tools for the job.

let me explain why -

Using official 20H2, it has not been manipulated or distorted, so it will install every time
The ISO you created has been manipulated, so it can only be put down to something YOU have done to the image, and NOT the program you used.
 

haseakash

New Member
There is one possible solution for this setuation. Tell me it will work or not or any advices ...


Possible solution 1 : i have to reboot computer again before setupcomplete starts. and resume it after restart (before desktop appers).
But how?


Possible solution 2 : can i use oobe.cmd and setupcomplete.cmd together? i read that oobe.cmd runs first before setupcomplte start.
can i restart my pc usning oobe.cmd and then start setupcomplete.cmd?



how can i do this???

i think my problem will solve if i restart pc before setupcomplete and then resume setupcomplete to next
 

haseakash

New Member
i just checked this.

i notice the problem in detail:

TEST 1:


i adds another OOBE.cmd in scripts folder.

yes its starting before setupcomplete.

but here is details:

windows installs 100% files>1st restart>
then setup copied custom exe files to windir in background >and launched oobe.cmd
(i launched cmd.exe and checked diskpart in OOBE. yes its showing usb drive.)
then 2nd restart happenes.

now setupcomplete start.
(i launched diskpart from 1st command in setupcomplete. )checked there is NO USB Drive found


this is a real problem.

Assuming its NTLite fault at when it copied custom files ro windir before 2nd restart .


may be ntlite ejecting that drive after copying files then 2nd restart happenes and then setupcomplete launches.


Test 2:

i restart pc (in setupcomple 1st line from cmd)
using shutdown /r
then my pc goes restart and started desktop directly without resuming setupcomple.
There is USB Drive Found. Yes i can see it.


FINAL POSSIBLE SOLUTION:

how can i restart pc at 1st line setupcomplete.cmd AND Then after restaring it will resume next lines?
How can i spilt setupcomplete???
just want restart and then start setucomplte to next..


Reply guys. I really need a solution
 
Top