@rem Install PosApp cashdesk application

@rem Check for admin rights
@fsutil dirty query %systemdrive% >nul 2>&1
@IF ERRORLEVEL 1 goto adminerror
@goto adminok

:adminerror
@echo The script must be run by an administrator
@pause
@goto end

:adminok
rem @echo off

set SRC=%~dp0

echo AutoLogon Settings
reg add "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon" /v AutoAdminLogon /t REG_SZ /d 0 /f
reg add "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon" /v DefaultUserName /t REG_SZ /d Emisys /f
rem reg add "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon" /v DefaultPassword /t REG_SZ /d "" /f

rem Start netplwiz to let the user type the login password
netplwiz

echo Set working hours to allow restart most of the time
reg add "HKLM\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings" /v ActiveHoursStart /t REG_DWORD /d 4 /f
reg add "HKLM\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings" /v ActiveHoursEnd /t REG_DWORD /d 5 /f
reg add "HKLM\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings" /v IsActiveHoursEnabled /t REG_DWORD /d 0 /f

echo Disable the metered feature per byte on wifi
rem Create xml file with: Netsh wlan export profile folder=c:\posapp\wifi
for %%f in (c:\posapp\wifi2\*.xml) do (
netsh wlan add profile filename="%%f"
netsh wlan set profileparameter name="%%~nf" cost=Unrestricted
)

rem Start the troublesome services
sc config bits start=auto
sc config wuauserv start=auto
sc start bits
sc start wuauserv

:end
