Jump to content

Remove Autologin


Recommended Posts

Hi All,

I'm currently creating an unattended installation for windows XP. After the installation the RunOnce runs a few programs that adds some addons for our company. To run the RunOnce the autlogon is turned on, but after the addons are installed the autologon should be removed. I've tried multiple solutions, but none of them work. So I'm going to post my files here, in the hope that some of you could give me a assit.


AutomaticUpdates="No"
Autopartition=0
MsDosInitiated="0"
UnattendedInstall="Yes"

[Unattended]
UnattendMode=DefaultHide
UnattendSwitch="Yes"
OemPreinstall=Yes
OemSkipEula=Yes
FileSystem=*
WaitForReboot="No"
NoWaitAfterTextMode=1
NoWaitAfterGUIMode=1
NonDriverSigningPolicy=Ignore
Repartition=No
DriverSigningPolicy="Ignore"
OemPnPDriversPath="a lot of drivers"

[DiskConfig]
Size1="5000"
FileSystem1=NTFS
PartitionType1="Primary"
Quickformat1="Yes"
Size2="5000"
FileSystem1=NTFS

[Display]
Xresolution=1024
Yresolution=768
BitsPerPel=32
Vrefresh=60

[SystemRestore]
DisableSR=1
CreateFirstRunRp=0

[GuiUnattended]
AdminPassword="*********"
TimeZone=110
OEMSkipRegional=1
OemSkipWelcome=1
AutoLogonCount=1

[UserData]
ProductKey="12345-12345-12345-12345-12345"
FullName="BCD Travel NL"
OrgName="SAMPLE"

[RegionalSettings]
LanguageGroup=1
SystemLocale="0409"
UserLocale="0413"
UserLocale_DefaultUser="0413"
InputLocale="0409:00000409"
InputLocale_DefaultUser="0409:00000409"
Language=00000409

[Networking]
InstallDefaultComponents="No"

[WindowsFirewall]
Profiles=WindowsFirewall.TurnOffFirewall

[WindowsFirewall.TurnOffFirewall]
Mode=0

[Identification]
JoinDomain="*********"
DomainAdmin=********
DomainAdminPassword=********

[TapiLocation]
CountryCode=31

[SetupParams]
UserExecute="WScript.exe %systemroot%\konten.js"

[Components]
freecell=off
hearts=off
minesweeper=off
msnexplr=off
pinball=off
solitaire=off
spider=off
msmsgs=off

[GuiRunOnce]
wucdcreator="wscript.exe %systemroot%\RunOnceEx.js"

[NetProtocols]
MS_TCPIP=params.MS_TCPIP

[NetAdapters]
Adapter1=params.Adapter1

[params.Adapter1]
InfID="*"

[params.MS_TCPIP]
AdapterSections=params.MS_TCPIP.Adapter1

[params.MS_TCPIP.Adapter1]
SpecificTo=Adapter1
DHCP=YES
DNSServerSearchOrder=10.218.4.5
WINS=no
NetBIOSOptions=0

//003

var soft = new Array();
var key = "HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\RunOnceEx\\";
var runonceex_js = "HKLM\\SOFTWARE\\RunOnceEx.js";
var WshShell = new ActiveXObject("WScript.Shell");
var fso = new ActiveXObject( "Scripting.FileSystemObject" );
var n = 0;

soft.title = "Set Up Software";
soft.insertNextMedium = "Please insert next disk with {soft}";
soft.rebootMessage = "Clean & Reboot";
soft.startReboot = "reboot.exe /t 60 /m \"{message}\" /r {runat}";

soft[n] = new Array();
soft[n].name = "Format";
soft[n].checkPoint = "Software\\Format";
soft[n][0] = "\"%CDROM%\\Software\\Format\\FormatD.bat\"";
n++;

soft[n] = new Array();
soft[n].name = "ADDONS";
soft[n].checkPoint = "Software\\ADDONS";
soft[n][0] = "\"%CDROM%\\Software\\ADDONS\\ADDONS.exe\"";
n++;

soft[n] = new Array();
soft[n].name = "JoinDomain";
soft[n].checkPoint = "Software\\JoinDomain";
soft[n][0] = "\"%CDROM%\\Software\\JoinDomain\\Joindomain.bat\"";
n++;

soft[n] = new Array();
soft[n].name = "RemoveAutoLogin";
soft[n].checkPoint = "Software\\RemoveAutoLogin";
soft[n][0] = "\"%CDROM%\\Software\\RemoveAutoLogin\\RemoveAUTOLOGIN.bat\"";
n++;

soft[n] = new Array();
soft[n].name = "-= REBOOT =-";
soft[n].checkPoint = "";
n++;

soft.startReboot = soft.startReboot.replace("{message}", soft.rebootMessage);
//soft.insertNextMedium = soft.insertNextMedium.replace( "{soft}", soft[a].name );

function FindDriveLetter( dir )
{
var e = new Enumerator( fso.Drives );
var x;
var letters = new Array();
var path;

for( ; !e.atEnd(); e.moveNext() )
{
x = e.item();

if( x.DriveType == 3 || x.IsReady )
{
letters = letters.concat( x.DriveLetter );
}

}

if( dir.length == 0)
{
return letters[0] + ":";
}

for( i = 0; i < letters.length; i++ )
{
if(dir.substr(0, 2) != "\\\\")
path = letters[i] + ":\\" + dir;

if( fso.FolderExists( path ) || fso.FileExists( path ) )
{
return letters[i] + ":";
}
}
return "";
}

function GetFilledString( zahl, fillChar, num_of_digits )
{
var filledStr = zahl.toString();
while( filledStr.length < num_of_digits )
{
filledStr = fillChar + filledStr;
}
return filledStr;
}
function RunOnceEx(index)
{
WshShell.RegWrite( key + "TITLE", soft.title, "REG_SZ" );
var netzwerk_install;

for( a = index; a < soft.length; a++ )
{
if( soft[a].name == "-= REBOOT =-" )
{
WshShell.RegWrite( key + GetFilledString(a, "0", 3) + "\\", soft.rebootMessage, "REG_SZ" );
WshShell.RegWrite( key + "TITLE",
soft.title + " " + (index+1).toString() + " - " + (a+1).toString() + " / " + soft.length.toString(),
"REG_SZ" );
WshShell.Run( "rundll32.exe iernonce.dll,RunOnceExProcess", 1, true );
soft.startReboot = soft.startReboot.replace("{runat}", (a + 1).toString());
WshShell.Run( soft.startReboot );

return ++a;
}
else
{
soft[a].drive = "";

if( soft[a].checkPoint.substr(0, 2) != "\\\\")
{
soft[a].drive = FindDriveLetter( soft[a].checkPoint );
netzwerk_install = 0;
}
else
netzwerk_install = 1;

if( soft[a].drive.length == 0 && netzwerk_install == 0 )
{
WshShell.RegWrite( key + "TITLE",
soft.title + " " + (index+1).toString() + " - " + a.toString() + " / " + soft.length.toString(),
"REG_SZ" );
WshShell.Run("rundll32.exe iernonce.dll,RunOnceExProcess", 1, true);
soft[a].drive = FindDriveLetter( soft[a].checkPoint );
}
if( soft[a].drive.length == 0 && netzwerk_install == 0 )
{
WshShell.Popup( soft.insertNextMedium.replace( "{soft}", soft[a].name ), 60, "", 64 );
soft[a].drive = FindDriveLetter( soft[a].checkPoint );
}
if( soft[a].drive.length == 0 && netzwerk_install == 0 )
{
WshShell.Popup( soft.insertNextMedium.replace( "{soft}", soft[a].name ), 60, "", 64 );
soft[a].drive = FindDriveLetter( soft[a].checkPoint );
}
if( soft[a].drive.length == 0 && netzwerk_install == 0 )
{
WScript.Echo( soft.insertNextMedium.replace( "{soft}", soft[a].name ) );
soft[a].drive = FindDriveLetter( soft[a].checkPoint );
index = a+1;
}
if(soft[a].drive.length || netzwerk_install == 1 )
{
WshShell.RegWrite( key + GetFilledString(a, "0", 3) + "\\", soft[a].name, "REG_SZ" );
for(b = 0; b < soft[a].length; b++)
{
if( netzwerk_install == 0 )
soft[a][b] = soft[a][b].replace( "%CDROM%", soft[a].drive );
else
soft[a][b] = soft[a][b].replace( "%CDROM%", "" );

WshShell.RegWrite( key + GetFilledString( a, "0", 3 ) + "\\" + GetFilledString( b, "0", 2 ),
soft[a][b], "REG_SZ" );
}
}
}
}

if( index > 0 && index < soft.length )
{
WshShell.RegWrite( key + "TITLE",
soft.title + " " + ( index + 1 ).toString() + " - " + soft.length.toString() + " / " + soft.length.toString(),
"REG_SZ" );
}

if( index < soft.length )
{
WshShell.Run( "rundll32.exe iernonce.dll,RunOnceExProcess", 1, true );
}
return soft.length;
}
function main()
{
//var namedArgs = WScript.Arguments.Named;
//var nextaction = WshShell.RegRead( runonceex_js + "\\" );
var startAt = 0;
//var wait_sek = 0;
var WshSysEnv = WshShell.Environment( "SYSTEM" );
var driversDir = WshSysEnv( "systemdrive" );
driversDir += "\\Drivers";

try
{
startAt = WshShell.RegRead( runonceex_js + "\\runat" );
WshShell.RegDelete( runonceex_js + "\\runat" );
}
catch(e){}

if( RunOnceEx( startAt ) == soft.length )
{
if( fso.FolderExists( driversDir ) )
{
fso.DeleteFolder( driversDir, true );
}
try
{
WshShell.RegDelete( runonceex_js );
}
catch(e){}
}
}

main();

@ECHO OFF
REM #####################
REM # Script created by Yves van Elk #
REM # BCD Travel Netherlands #
REM #####################

REM This script removes the autologon, this is not nessesary anymore.
REGEDIT /S AutoLogon.reg

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon]
"AutoRestartShell"=dword:00000001
"DefaultDomainName"="*****"
"DefaultUserName"="******"
"LegalNoticeCaption"=""
"LegalNoticeText"=""
"PowerdownAfterShutdown"="0"
"ReportBootOk"="1"
"Shell"="Explorer.exe"
"ShutdownWithoutLogon"="0"
"System"=""
"Userinit"="C:\\WINDOWS\\system32\\userinit.exe,"
"VmApplet"="rundll32 shell32,Control_RunDLL \"sysdm.cpl\""
"SfcQuota"=dword:ffffffff
"allocatecdroms"="0"
"allocatedasd"="0"
"allocatefloppies"="0"
"cachedlogonscount"="10"
"forceunlocklogon"=dword:00000000
"passwordexpirywarning"=dword:0000000e
"scremoveoption"="0"
"DisableCAD"=dword:00000000
"AllowMultipleTSSessions"=dword:00000000
"UIHost"=hex(2):6c,00,6f,00,67,00,6f,00,6e,00,75,00,69,00,2e,00,65,00,78,00,65,\
00,00,00
"DebugServerCommand"="no"
"DefaultPassword"="*******"
"AutoAdminLogon"="0"
"SFCDisable"=dword:00000000
"WinStationsDisabled"="0"
"LogonType"=dword:00000000
"HibernationPreviouslyEnabled"=dword:00000001
"CachePrimaryDomain"="****"
"DCacheUpdate"=hex:5e,a0,33,7b,18,2a,c9,01
"ShowLogonOptions"=dword:00000000
"AltDefaultUserName"="*****"
"AltDefaultDomainName"="*****"

If you guys need some more files please let me know. I'm kind of lost now...

Link to comment
Share on other sites


I use a few simple lines in my cleanup batch script:

SET KEY2="HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon"

:: Delete Auto Admin Logon credentials and replace with policy defualt

REG DELETE %KEY2% /V DefaultPassword /f
REG DELETE %KEY2% /V DefaultDomainName /f
REG DELETE %KEY2% /V AutoAdminLogon /f
REG DELETE %KEY2% /V ForceAutoLogon /f

Link to comment
Share on other sites

Thnx, I'm going to try this in the new version. I've now fixed it via a (what I think) a really dirty script. This copy's the regkey to the %systemdrive% and then runs it, after this, the key is removed again.

But as told earlier, I'm going to try above in the new version. Thnx!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...