Windows 7 - Launch Bat after installation (SetupComplete?)

#1
Hello guys!
I'm wondering about a script I made after the installation of my Windows 7 x64 ISO is done. The script (bat) contains this:


@echo off
cd C:\Users\
RD /S /Q "C:\Users\Public\"

cd C:\Users\Unknown\
ATTRIB +H "C:\Users\Unknown\Desktop"
RD /S /Q "C:\Users\Unknown\Searches"
RD /S /Q "C:\Users\Unknown\Saved Games"
RD /S /Q "C:\Users\Unknown\Videos"
RD /S /Q "C:\Users\Unknown\Links"
RD /S /Q "C:\Users\Unknown\Favorites"
RD /S /Q "C:\Users\Unknown\Contacts"

cd C:\
RD /S /Q "C:\PerfLogs\"
RD /S /Q "C:\Program Files\Uninstall Information"
RD /S /Q "C:\Program Files\Windows Media Player"
ATTRIB +H "C:\Program Files\Common Files" /S /D
ATTRIB +H "C:\Program Files\DVD Maker" /S /D
ATTRIB +H "C:\Program Files\Internet Explorer" /S /D
ATTRIB +H "C:\Program Files\MSBuild" /S /D
ATTRIB +H "C:\Program Files\Reference Assemblies" /S /D
ATTRIB +H "C:\Program Files\Windows Defender" /S /D
ATTRIB +H "C:\Program Files\Windows Mail" /S /D
ATTRIB +H "C:\Program Files\Windows NT" /S /D
ATTRIB +H "C:\Program Files\Windows Photo Viewer" /S /D

cd C:\Program Files (x86)\
RD /S /Q "C:\Program Files (x86)\Uninstall Information"
ATTRIB +H "C:\Program Files (x86)\Common Files" /S /D
ATTRIB +H "C:\Program Files (x86)\Internet Explorer" /S /D
ATTRIB +H "C:\Program Files (x86)\MSBuild" /S /D
ATTRIB +H "C:\Program Files (x86)\Reference Assemblies" /S /D
ATTRIB +H "C:\Program Files (x86)\Windows Defender" /S /D
ATTRIB +H "C:\Program Files (x86)\Windows Mail" /S /D
ATTRIB +H "C:\Program Files (x86)\Windows NT" /S /D
ATTRIB +H "C:\Program Files (x86)\Windows Photo Viewer" /S /D




cd C:\ProgramData\Microsoft\Windows\Start Menu\
RD /S /Q "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup"
RD /S /Q "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Maintenance"
RD /S /Q "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Games"
RD /S /Q "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Accessories\Windows PowerShell"
RD /S /Q "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Accessories\System Tools"
RD /S /Q "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Accessories\Accessibility"
DEL /F /S /Q /A "C:\ProgramData\Microsoft\Windows\Start Menu\Default Programs.lnk"
DEL /F /S /Q /A "C:\ProgramData\Microsoft\Windows\Start Menu\Windows Update.lnk"
DEL /F /S /Q /A "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Accessories\Sync Center.lnk"
DEL /F /S /Q /A "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Accessories\Sound Recorder.lnk"
DEL /F /S /Q /A "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Accessories\Remote Desktop Connection.lnk"
DEL /F /S /Q /A "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Accessories\Paint.lnk"
DEL /F /S /Q /A "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Accessories\displayswitch.lnk"
DEL /F /S /Q /A "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Accessories\Calculator.lnk"
DEL /F /S /Q /A "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Accessories\Welcome Center.lnk"

cd C:\Users\Unknown\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\
RD /S /Q "C:\Users\Unknown\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\"
RD /S /Q "C:\Users\Unknown\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Maintenance\"
RD /S /Q "C:\Users\Unknown\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Administrative Tools\"
RD /S /Q "C:\Users\Unknown\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Accessories\Accessibility"
RD /S /Q "C:\Users\Unknown\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Accessories\System Tools"
DEL /F /S /Q /A "C:\Users\Unknown\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Accessories\Windows Explorer.lnk"
DEL /F /S /Q /A "C:\Users\Unknown\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Accessories\Run.lnk"
DEL /F /S /Q /A "C:\Users\Unknown\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Accessories\Command Prompt.lnk"

C:\Windows\
RD /S /Q "C:\Windows\Downloaded Program Files"
RD /S /Q "C:\Windows\LiveKernelReports"
RD /S /Q "C:\Windows\Logs"
RD /S /Q "C:\Windows\ModemLogs"
RD /S /Q "C:\Windows\Offline Web Pages"
RD /S /Q "C:\Windows\Temp"
RD /S /Q "C:\Windows\WinToolkit"





cd C:\ProgramData\Microsoft\User Account Pictures\
REN "C:\ProgramData\Microsoft\User Account Pictures\user.bmp" "user.x"
REN "C:\ProgramData\Microsoft\User Account Pictures\guest.bmp" "guest.x"




How should I implant this script after the Win7 installation is done. Tried with SetupComplete (see spolier):


\sources\$OEM$\$$\Setup\Scripts


@echo OFF
cd %~dp0
attrib -R -A -S -H *.*
SHUTDOWN /R /T 5
RMDIR /S /Q "%WINDIR%\Setup\Scripts"

@echo off
cd C:\Users\
RD /S /Q "C:\Users\Public\"

cd C:\Users\Unknown\
ATTRIB +H "C:\Users\Unknown\Desktop"
RD /S /Q "C:\Users\Unknown\Searches"
RD /S /Q "C:\Users\Unknown\Saved Games"
RD /S /Q "C:\Users\Unknown\Videos"
RD /S /Q "C:\Users\Unknown\Links"
RD /S /Q "C:\Users\Unknown\Favorites"
RD /S /Q "C:\Users\Unknown\Contacts"

cd C:\
RD /S /Q "C:\PerfLogs\"
RD /S /Q "C:\Program Files\Uninstall Information"
RD /S /Q "C:\Program Files\Windows Media Player"
ATTRIB +H "C:\Program Files\Common Files" /S /D
ATTRIB +H "C:\Program Files\DVD Maker" /S /D
ATTRIB +H "C:\Program Files\Internet Explorer" /S /D
ATTRIB +H "C:\Program Files\MSBuild" /S /D
ATTRIB +H "C:\Program Files\Reference Assemblies" /S /D
ATTRIB +H "C:\Program Files\Windows Defender" /S /D
ATTRIB +H "C:\Program Files\Windows Mail" /S /D
ATTRIB +H "C:\Program Files\Windows NT" /S /D
ATTRIB +H "C:\Program Files\Windows Photo Viewer" /S /D

cd C:\Program Files (x86)\
RD /S /Q "C:\Program Files (x86)\Uninstall Information"
ATTRIB +H "C:\Program Files (x86)\Common Files" /S /D
ATTRIB +H "C:\Program Files (x86)\Internet Explorer" /S /D
ATTRIB +H "C:\Program Files (x86)\MSBuild" /S /D
ATTRIB +H "C:\Program Files (x86)\Reference Assemblies" /S /D
ATTRIB +H "C:\Program Files (x86)\Windows Defender" /S /D
ATTRIB +H "C:\Program Files (x86)\Windows Mail" /S /D
ATTRIB +H "C:\Program Files (x86)\Windows NT" /S /D
ATTRIB +H "C:\Program Files (x86)\Windows Photo Viewer" /S /D




cd C:\ProgramData\Microsoft\Windows\Start Menu\
RD /S /Q "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup"
RD /S /Q "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Maintenance"
RD /S /Q "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Games"
RD /S /Q "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Accessories\Windows PowerShell"
RD /S /Q "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Accessories\System Tools"
RD /S /Q "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Accessories\Accessibility"
DEL /F /S /Q /A "C:\ProgramData\Microsoft\Windows\Start Menu\Default Programs.lnk"
DEL /F /S /Q /A "C:\ProgramData\Microsoft\Windows\Start Menu\Windows Update.lnk"
DEL /F /S /Q /A "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Accessories\Sync Center.lnk"
DEL /F /S /Q /A "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Accessories\Sound Recorder.lnk"
DEL /F /S /Q /A "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Accessories\Remote Desktop Connection.lnk"
DEL /F /S /Q /A "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Accessories\Paint.lnk"
DEL /F /S /Q /A "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Accessories\displayswitch.lnk"
DEL /F /S /Q /A "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Accessories\Calculator.lnk"
DEL /F /S /Q /A "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Accessories\Welcome Center.lnk"

cd C:\Users\Unknown\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\
RD /S /Q "C:\Users\Unknown\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\"
RD /S /Q "C:\Users\Unknown\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Maintenance\"
RD /S /Q "C:\Users\Unknown\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Administrative Tools\"
RD /S /Q "C:\Users\Unknown\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Accessories\Accessibility"
RD /S /Q "C:\Users\Unknown\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Accessories\System Tools"
DEL /F /S /Q /A "C:\Users\Unknown\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Accessories\Windows Explorer.lnk"
DEL /F /S /Q /A "C:\Users\Unknown\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Accessories\Run.lnk"
DEL /F /S /Q /A "C:\Users\Unknown\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Accessories\Command Prompt.lnk"

C:\Windows\
RD /S /Q "C:\Windows\Downloaded Program Files"
RD /S /Q "C:\Windows\LiveKernelReports"
RD /S /Q "C:\Windows\Logs"
RD /S /Q "C:\Windows\ModemLogs"
RD /S /Q "C:\Windows\Offline Web Pages"
RD /S /Q "C:\Windows\Temp"
RD /S /Q "C:\Windows\WinToolkit"


cd C:\ProgramData\Microsoft\User Account Pictures\
REN "C:\ProgramData\Microsoft\User Account Pictures\user.bmp" "user.x"
REN "C:\ProgramData\Microsoft\User Account Pictures\guest.bmp" "guest.x"



Problem is, I cant use GPO either because I do prefer Home Premium. Many thanks guys and love yaaaa <3
 


This website is not affiliated, owned, or endorsed by Microsoft Corporation. It is a member of the Microsoft Partner Program.
Top