rob781
New Member
- Reaction score
- 0
- Location
- Chicago, IL, USA
I'm having problems running this script in XP it works fine in Vista/Win7 but keep getting Access is Denied Error in Win XP when I try to restore the reg setting back to what is was before I started. The problem is in the finish batch file..
Any Idea what I'm doing wrong or how to do it better.
start batch
finish batch
mod.reg
reg restore "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon" c:\before.hiv
Any Idea what I'm doing wrong or how to do it better.
start batch
Code:
echo off
TITLE Getting OS Version...
goto TEST_WIN7
:TEST_WIN7
VER | FIND /I "Version 6.1" >NUL
IF ERRORLEVEL 1 (GOTO TEST_VISTA)
SET OPERATING_SYSTEM=win7
@echo win7
echo **********************************************
echo saving the orginal settings
reg save "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon" c:\before.hiv
echo deleting any pre user CompPartsDepot
net user CompPartsDepot /delete
echo making user CompPartsDepot
net user CompPartsDepot /add
echo setting CompPartsDepot as admin rights
net localgroup administrators CompPartsDepot /add
echo importing auto log in setting
reg import c:\mod.reg
GOTO end
:TEST_VISTA
VER | FIND /I "Version 6.0" >NUL
IF ERRORLEVEL 1 (GOTO TEST_SERVER)
rem SET OPERATING_SYSTEM=Windows Vista/Server 2008
@echo vista
echo saving the orginal settings
reg save "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon" c:\before.hiv
echo deleting any pre user CompPartsDepot
net user CompPartsDepot /delete
echo making user CompPartsDepot
net user CompPartsDepot /add
echo setting CompPartsDepot as admin rights
net localgroup administrators CompPartsDepot /add
echo importing auto log in setting
reg import c:\mod.reg
GOTO end
:TEST_SERVER
VER | FIND /I "Version 5.2" >NUL
IF ERRORLEVEL 1 (GOTO TEST_XP)
echo Windows Server 2003/Home Server
SET OPERATING_SYSTEM=Windows Server 2003/Home Server
GOTO Not_Supported_At_ThisTime
GOTO end
:TEST_XP
VER | FIND /I "Version 5.1" >NUL
IF ERRORLEVEL 1 (GOTO TEST_2000)
echo SYSTEM=Windows XP/WFLP
SET OPERATING_SYSTEM=Windows XP/WFLP
rem GOTO Not_Supported_At_ThisTime
@echo XP
echo **********************************************
echo saving the orginal settings
reg save "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon" c:\before.hiv
echo deleting any pre user CompPartsDepot
net user CompPartsDepot /delete
echo making user CompPartsDepot
net user CompPartsDepot /add
echo setting CompPartsDepot as admin rights
net localgroup administrators CompPartsDepot /add
echo importing auto log in setting
reg import c:\mod.reg
GOTO end
:Not_Supported_At_ThisTime
echo *******
Echo Sorry this OS is not supported at this time plase check back latter.
echo *******
goto end
:TEST_2000
echo not supported
goto end
:end
pause
finish batch
Code:
@echo off
TITLE Getting OS Version...
goto TEST_WIN7
:TEST_WIN7
VER | FIND /I "Version 6.1" >NUL
IF ERRORLEVEL 1 (GOTO TEST_VISTA)
SET OPERATING_SYSTEM=win7
@echo win7
echo **********************************************
echo Deleting CompPartsDepot
net user CompPartsDepot /delete
echo restoring the orginal settings
reg restore "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon" c:\before.hiv
echo deleting backup hive
del c:\before.hiv
GOTO end
:TEST_VISTA
VER | FIND /I "Version 6.0" >NUL
IF ERRORLEVEL 1 (GOTO TEST_SERVER)
rem SET OPERATING_SYSTEM=Windows Vista/Server 2008
@echo vista
echo **********************************************
echo Deleting CompPartsDepot
net user CompPartsDepot /delete
echo restoring the orginal settings
reg restore "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon" c:\before.hiv
echo deleting backup hive
del c:\before.hiv
GOTO end
:TEST_SERVER
VER | FIND /I "Version 5.2" >NUL
IF ERRORLEVEL 1 (GOTO TEST_XP)
echo Windows Server 2003/Home Server
SET OPERATING_SYSTEM=Windows Server 2003/Home Server
GOTO Not_Supported_At_ThisTime
GOTO end
:TEST_XP
VER | FIND /I "Version 5.1" >NUL
IF ERRORLEVEL 1 (GOTO TEST_2000)
rem echo SYSTEM=Windows XP/WFLP
SET OPERATING_SYSTEM=Windows XP/WFLP
@echo XP
echo **********************************************
echo Deleting CompPartsDepot
net user CompPartsDepot /delete
echo restoring the orginal settings
reg restore "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon" c:\before.hiv
echo deleting backup hive
del c:\before.hiv
GOTO end
:Not_Supported_At_ThisTime
echo *******
Echo Sorry this OS is not supported at this time plase check back latter.
echo *******
goto end
:TEST_2000
echo not supported
goto end
:end
pause
mod.reg
Code:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon]
"DefaultUserName"="CompPartsDepot"
"DefaultPassword"=""
"AutoAdminLogon"="1"