Skip to content

Instantly share code, notes, and snippets.

@ruzickap ruzickap/win7-user.bat
Last active Dec 27, 2015

What would you like to do?
win7 customization file. Run right after you first log in with administrator rights.
:: Tested on Windows 7
echo on
rem for /f "tokens=3" %%i in ('netsh interface ip show addresses "Local Area Connection" ^|findstr IP.Address') do set IP=%%i
rem for /f "tokens=2 delims=. " %%j in ('nslookup %IP% ^|find "Name:"') do set HOSTNAME=%%j
@echo Enable Administrator
net user administrator /active:yes
@echo Change password and Password Complexity to allow simple passwords
net accounts /maxpwage:unlimited
net accounts /minpwlen:0
secedit /export /cfg c:\password.cfg
powershell -command "${c:\password.cfg}=${c:\password.cfg} | %% {$_.Replace('PasswordComplexity = 1', 'PasswordComplexity = 0')}"
secedit /configure /db %windir%\security\new.sdb /cfg c:\password.cfg /areas SECURITYPOLICY
del c:\password.cfg
net user Administrator xxxx
@echo Autologin
rem reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v AutoAdminLogon /t REG_SZ /d "1" /f
reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v DefaultUserName /t REG_SZ /d "Administrator" /f
reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v DefaultPassword /t REG_SZ /d "xxxx" /f
@echo Enable Remote Desktop
reg ADD "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections /t REG_DWORD /d 0 /f
@echo Set proxy settings
reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings" /v MigrateProxy /t REG_DWORD /d 0x1 /f
reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyServer /t REG_SZ /d ";;;;" /f
reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyOverride /t REG_SZ /d ^<local^>; /f
reg add "HKLM\Software\Policies\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxySettingsPerUser /t REG_DWORD /d 0x0 /f
@echo Creating bat script running on start to check if the proxy server is available or not.
echo @echo off ^
ping -n 3 ^
if %%ERRORLEVEL%% EQU 0 ( ^
@echo. ^
@echo *** Setting proxy ^
reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable /t REG_DWORD /d 0x1 /f ^
) else ( ^
@echo. ^
@echo *** Proxy disabled ^
) ^
> "%ProgramData%\Microsoft\Windows\Start Menu\Programs\Startup\proxy.bat"
start /MIN "%ProgramData%\Microsoft\Windows\Start Menu\Programs\Startup\proxy.bat"
@echo Configure NTP server
w32tm /config /manualpeerlist:"" /reliable:yes /update
net start w32time
rem w32tm /resync /rediscover
rem w32tm /query /peers
rem w32tm /query /status
@echo Disable firewall
netsh advfirewall set allprofiles state off
@echo Change TimeZone
tzutil /s "Central Europe Standard Time"
@echo Disable IPv6
reg add hklm\system\currentcontrolset\services\tcpip6\parameters /v DisabledComponents /t REG_DWORD /d 255
@echo Disable firewall
netsh advfirewall set allprofiles state off
rem @echo.
rem @echo Server name change
rem powershell -command "$sysInfo = Get-WmiObject -Class Win32_ComputerSystem; $sysInfo.Rename('%HOSTNAME%');"
@echo Run IE to get proxy settings working properly (workaround for proxy settings)
start /d "%PROGRAMFILES%\Internet Explorer" iexplore.exe
@echo Disable Windows Update
reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update" /v AUOptions /t REG_DWORD /d 1 /f
reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update" /v AUState /t REG_DWORD /d 7 /f
ping -n 3 > nul
shutdown /r /t 0
move c:\win7-user.bat c:\windows\temp\
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.