Skip to content

Instantly share code, notes, and snippets.

@ruzickap
Last active October 18, 2023 02:47
Show Gist options
  • Save ruzickap/7395426 to your computer and use it in GitHub Desktop.
Save ruzickap/7395426 to your computer and use it in GitHub Desktop.
win7 customization file. Run right after you first log in as administrator.
:: Tested on Windows 7
@echo.
@echo Test connection settings
powershell -command "$client = new-object System.Net.WebClient; $client.DownloadFile('http://www.google.com', 'c:\del')"
if %ERRORLEVEL% NEQ 0 (
@echo Can not download files form Internet !!!
pause
exit
)
del c:\del
@echo.
@echo Import certificates to skip "Would you like to install this device software" prompt when installing Spice Guest Tools
:: http://edennelson.blogspot.cz/2013/02/deploying-openvpn.html
powershell -command "$client = new-object System.Net.WebClient; $client.DownloadFile('http://zeenix.fedorapeople.org/drivers/win-tools/postinst/redhat10.cer', 'c:\redhat.cer')"
certutil -addstore "TrustedPublisher" c:\redhat.cer
del c:\redhat.cer
powershell -command "$client = new-object System.Net.WebClient; $client.DownloadFile('http://zeenix.fedorapeople.org/drivers/win-tools/postinst/redhat09.cer', 'c:\redhat.cer')"
certutil -addstore "TrustedPublisher" c:\redhat.cer
del c:\redhat.cer
@echo.
@echo Change IE homepage + disable Tour + disable Check Associations + disable First Home Page + disable OOBE + disable Server Manager
reg add "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main" /v "Start Page" /d "https://google.com" /f
reg add "HKCU\Software\Microsoft\Internet Explorer\Main" /v "Default_Page_URL" /d "https://google.com" /f
reg add "HKCU\Software\Microsoft\Internet Explorer\Main" /v "DisableFirstRunCustomize" /t REG_DWORD /d 1 /f
reg add "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main" /v "Check_Associations" /d "no" /f
reg add "HKCU\Software\Microsoft\Internet Explorer\Main" /v "NoProtectedModeBanner" /t REG_DWORD /d 1 /f
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ServerManager\Oobe" /v "DoNotOpenInitialConfigurationTasksAtLogon" /t REG_DWORD /d 1 /f
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ServerManager" /v "DoNotOpenServerManagerAtLogon" /t REG_DWORD /d 1 /f
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\MAIN\ESCHomePages" /v "SoftAdmin" /d "https://google.com" /f
@echo.
@echo Disable "Check whether IE is the default browser?"
reg add "HKLM\SOFTWARE\Microsoft\Active Setup\Installed Components\{A509B1A7-37EF-4b3f-8CFC-4F3A74704073}" /v IsInstalled /t REG_DWORD /d 00000000 /f
@echo.
@echo Download and install 7-Zip
powershell -command "$client = new-object System.Net.WebClient; $client.DownloadFile('http://switch.dl.sourceforge.net/project/sevenzip/7-Zip/9.20/7z920.msi', 'c:\7z.msi')"
msiexec /i c:\7z.msi /qn
del /f c:\7z.msi
@echo.
@echo Download SSH Server
powershell -command "$client = new-object System.Net.WebClient; $client.DownloadFile('https://www.itefix.no/i2/sites/default/files/Copssh_3.1.4_Installer.zip', 'c:\Copssh_Installer.zip')"
"%PROGRAMFILES%\7-Zip\7z.exe" x -oc:\ c:\Copssh_Installer.zip
c:\Copssh_3.1.4_Installer.exe /u=root /p=xxxx /S
del /f c:\Copssh_3.1.4_Installer.exe c:\Copssh_Installer.zip
echo ssh-rsa xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ruzickap@peru >> "%PROGRAMFILES%\ICW\home\Administrator\.ssh\authorized_keys"
(
echo -----BEGIN RSA PRIVATE KEY-----
echo xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
echo -----END RSA PRIVATE KEY-----
) > "%PROGRAMFILES%\ICW\home\Administrator\.ssh\id_rsa"
(
echo Host *
echo UserKnownHostsFile /dev/null
echo StrictHostKeyChecking no
echo User root
) > "%PROGRAMFILES%\ICW\home\Administrator\.ssh\config"
@echo.
@echo Download an install WinSCP
powershell -command "$client = new-object System.Net.WebClient; $client.DownloadFile('http://garr.dl.sourceforge.net/project/winscp/WinSCP/5.1.7/winscp517setup.exe', 'c:\winscpsetup.exe')"
c:\winscpsetup.exe /silent /sp
del /f c:\winscpsetup.exe
reg add "HKEY_CURRENT_USER\Software\Martin Prikryl\WinSCP 2\Sessions\Default%20Settings" /v "HostName" /t REG_SZ /d "192.168.122.1" /f
reg add "HKEY_CURRENT_USER\Software\Martin Prikryl\WinSCP 2\Sessions\Default%20Settings" /v "UserName" /t REG_SZ /d "ruzickap" /f
@echo.
@echo Download an install Double Commander
powershell -command "$client = new-object System.Net.WebClient; $client.DownloadFile('http://optimate.dl.sourceforge.net/project/doublecmd/DC%%20for%%20Windows%%2032%%20bit/Double%%20Commander%%200.5.6%%20beta/doublecmd-0.5.6.i386-win32.exe', 'c:\doublecmd.exe')"
c:\doublecmd.exe /sp /silent /MERGETASKS="desktopicon"
del /f c:\doublecmd.exe
@echo Download Putty
powershell -command "$client = new-object System.Net.WebClient; $client.DownloadFile('http://the.earth.li/~sgtatham/putty/latest/x86/putty-0.63-installer.exe', 'c:\putty-installer.exe')"
c:\putty-installer.exe /silent /sp /MERGETASKS="desktopicon"
del /f c:\putty-installer.exe
@echo.
@echo Download and install Firefox
powershell -command "$client = new-object System.Net.WebClient; $client.DownloadFile('http://download.cdn.mozilla.net/pub/mozilla.org/firefox/releases/23.0.1/win32/en-US/Firefox%%20Setup%%2023.0.1.exe', 'c:\Firefox_Setup.exe')"
c:\Firefox_Setup.exe -ms
del /f c:\Firefox_Setup.exe
@echo.
@echo Download Notepad++
powershell -command "$client = new-object System.Net.WebClient; $client.DownloadFile('http://download.tuxfamily.org/notepadplus/6.4.1/npp.6.4.1.Installer.exe', 'c:\npp.Installer.exe')"
c:\npp.Installer.exe /S
del /f c:\npp.Installer.exe
@echo.
@echo Download and install Spice
powershell -command "$client = new-object System.Net.WebClient; $client.DownloadFile('http://spice-space.org/download/windows/spice-guest-tools/spice-guest-tools-0.59.exe', 'c:\spice-guest-tools.exe')"
c:\spice-guest-tools.exe /S
del /f c:\spice-guest-tools.exe
@echo.
@echo Download and install JRE
rem powershell -command "$client = new-object System.Net.WebClient; $client.DownloadFile('http://download.kb.cz/jre-7u45-windows-i586.exe', 'c:\jre-windows.exe')"
powershell -command "$client = new-object System.Net.WebClient; $client.DownloadFile('http://javadl.sun.com/webapps/download/AutoDL?BundleId=81819', 'c:\jre-windows.exe')"
c:\jre-windows.exe /s
del /f c:\jre-windows.exe
@echo.
@echo Download and install DesktopInfo
powershell -command "$client = new-object System.Net.WebClient; $client.DownloadFile('http://www.glenn.delahoy.com/software/files/DesktopInfo120.zip', 'c:\DesktopInfo.zip')"
"%PROGRAMFILES%\7-Zip\7z.exe" x -o"%PROGRAMFILES%\DesktopInfo" c:\DesktopInfo.zip
del c:\DesktopInfo.zip
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Run" /v DesktopInfo /t reg_sz /d "%PROGRAMFILES%\DesktopInfo\DesktopInfo.exe" /f
@echo.
@echo Disable Hibernate
powercfg -h off
@echo.
@echo Disable piracy warning
start SLMGR -REARM
@echo.
@echo Change pagefile size
wmic.exe computersystem set AutomaticManagedPagefile=False
wmic pagefileset where name="C:\\pagefile.sys" set InitialSize=512,MaximumSize=512
wmic pagefileset list /format:list
@echo.
@echo Clean mess
cleanmgr /sagerun:11
@echo.
@echo Compact all files
compact /c /s /i /q > NUL
pause
shutdown /r /t 0
move c:\win7-admin.bat c:\windows\temp\
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment