$OEM$ folder incomplete - Doesn't copy it all?

BladedThoth

New Member
I have been seeing if NTLite will do what I need. I have butted into a couple of challenges.

First, I bumped into that Post-Setup seemed to have corrupted or something in the XML file. This caused a few weird bugs, so I started over.

I noticed if you put an argument into a User, and then after compiling the image, you can have it remove the argument and visually in NTLite, it shows gone. But after compiling it, the switch pops back in. To fix this issue, I had to remove the line item and put it back in.

The bug that is turning into a show stopper for me is the $OEM$ folder. First few times it went okay, but then I started having all sorts of weird issues. Scripts not running, apps not running. I went and checked all the permissions, made them very liberal. I dug into the resulting ISO, and the sources/$OEM$ contents are all intact inside, and when I rufus a drive, it is still there. However, when I install windows, it drops initially random files. Now, it is consistent.

I made a preset and wiped out the entire folder, started from a fresh ISO from Microsoft for Win11. Ran the preset, seemed to take, but nope. It is consistent now. Drops the entire folder of Scripts, and two EXEs inside.

Anyone have any suggestions what I'm doing wrong?
 
Sometimes entering data inside the Post-Setup UI is tricky. But a screen capture and a copy of your preset (minus any user passwords or product key) would help us visualize the problem.

Normally, NTLite will auto-populate the $OEM$ folder for you. Also explain which commands you want to run under which context (Machine vs. User) so we don't have to guess if the setup's wrong.
 
I had read that you can drop stuff directly into the sources folder once you decompress the original ISO (It is the way suggested here for changing out desktop wallpaper/Profile icon/lock screen.)

It had been working until I started having problems with the Post-Setup.

Once I can get back to my computer I will send both.
 
There's two (actually three) methods with the $OEM$ folder.

1. Do everything inside NTLite; it will create sources\$OEM$, copy your scripts there, and write a SetupComplete.cmd wrapper to execute everything. Post-Setup (User Execution) tasks are converted to RunOnceEx tasks, running on first logon.

2. Do everything manually. Create sources\$OEM$ and follow $$ & $1 notation for C:\Windows and C:\ folders. Copy everything to wherever you wish, and write your own $OEM$\$$\Setup\Scripts\SetupComplete.cmd wrapper.

Just remember the whole %WINDIR%\Setup\Scripts argument when calling scripts by pathname.

3. [Hybrid] Do most of the normal work using NTLite. After you're done editing the install images, but before making an ISO -- manually edit the $OEM$ folders and tweak SetupComplete.cmd. This is useful for allowing NTLite to do the boring installers work, and you do the weird custom work which is too much work for NTLite.

Make NTLite create the ISO from the folder when done.
 
There's two (actually three) methods with the $OEM$ folder.
Let me describe the process I used more concisely.
  1. Decompress ISO to folder on exFAT external SSD (Shouldn't have permission problems)
  2. Created $OEM$\ inside of extracted folder's sources\
  3. Created $$\ inside $OEM$\ To customize wallpaper/lock screen
  4. Created $1\ inside $OEM$\ To change default Profile Icons and then Software folder and Scripts folder
  5. Used NTLite to set up Machine and User Post-Setup
  6. Wrote image, checked $OEM$ stayed intact
  7. Created ISO
  8. Inspected ISO - $OEM$ folder and its contents are intact
  9. Wrote ISO to USB with Rufus
  10. Inspected USB - $OEM$ folder still intact
  11. Installed a test install - Some items from the $OEM$ folders are missing on installed computer, causing failures in Post-Setup
    1. All scripts and the Script folder are totally gone from the fresh install
    2. One MSI and one config file from the Software folder missing
  12. Inspected USB - Folders and files are all still present in full.
I'm just messing with it now. I will grab the XML file. Do you need the entire thing?

I have built $OEM$ images before (quite a while ago,) just wanted something simpler for myself without monkeying.

I based this on the discussion about winget-OEM.

Fearing I will have to rebuild this a third time. o_O
 
$OEM$\$$\Setup will be cleaned up by SetupComplete's final steps (it removes the folders and itself).

Out of curiousity, are you using a NTFS filesystem on the Rufus drive?
 
$OEM$\$$\Setup will be cleaned up by SetupComplete's final steps (it removes the folders and itself).

Out of curiousity, are you using a NTFS filesystem on the Rufus drive?
I saw that in one of the scripts that Setup\ gets purged. I like to keep around an installer for additional users, for example.

Yes, I am using NTFS for the final USB. I've been half tempted to look at chowning $OEM$ or changing my $OEM$ folder permissions.
 
Folder permissions don't matter, everything under $OEM$ is copied as SYSTEM user. This only affects cleanup of $1 folders, where Administrator doesn't have default rights to remove it.

The only thing I can think of is folder names with spaces or special characters.
 
Folder permissions don't matter, everything under $OEM$ is copied as SYSTEM user. This only affects cleanup of $1 folders, where Administrator doesn't have default rights to remove it.

The only thing I can think of is folder names with spaces or special characters.
Oh. OH OH... I just had a thought... I wondering if the SetupComplete.cmd EDIT: cleanup script deletes ANY Scripts folder in $1?

EDIT #2: It is contained in a "LocalConfig" folder. I did check, no spaces, no special characters. <drive>:\sources\$OEM$\$1\LocalConfig\Scripts
 
Last edited:
NTLite's SetupComplete will always remove $$\Setup (or C:\Windows\Setup) since you shouldn't leave junk in C:\Windows.
$1, $2, etc. will be untouched. This is where you need to keep files for first logon scripts.

For a sanity check, do this:
Make first line in SetupComplete (you can edit it manually)
Code:
dir C:\LocalConfig\Scripts > C:\log.txt
 
It was there in the log.txt...

I'm the bonehead. I didn't want my scripts scattered, so I moved the WinGet scripts into that folder. I usually audit PowerShell I find online before using, and found hard-coded path so I updated that to the folder location.

I completely missed the line:

Code:
Remove-Item $PackagePath -Recurse -Force

Stranger, yet, the script fails AFTER that point but doesn't any longer since I commented it out...

(Script is from this thread: https://www.ntlite.com/community/in...in-ntlite-image-for-post-setup-installs.2916/ )

Thanks a LOT garlin - You're awesome :D
 
To explain for everyone, my install script removes its own C:\ temp folder when finished.

This should work if winget was a subfolder like $1\LocalConfig\Scripts\winget, so $PackagePath doesn't touch the parent directory.
 
To explain for everyone, my install script removes its own C:\ temp folder when finished.

This should work if winget were a subfolder like $1\LocalConfig\Scripts\winget, so $PackagePath doesn't touch the parent directory.
Yep! This would be the smarter idea! HAHA d'oh.

I hope I can contribute to this group. :) Thanks again garlin :)
 
I'm not sure why you're moving your question to this thread. -- We don't need duplicate discussions.
Post-Setup (User Execution) works on free edition. I confirmed it creates the RunOnceEx keys.
 
Back
Top