Skip to content

Sysprep\_SetLocalAdminPassword

VB Scripting Library > OSD Scripting Library > Sysprep functions (OSD)

Set the password for the local administrator in the unattend file.

ARGUMENTDESCRIPTIONTYPE
sPasswordAdministrator password. Maximum length is 127 characters, Use * for blank or NULL.String

Boolean, TRUE if function completed successfully.

UNATTEND FILECOMPONENT PATH / SECTIONSETTINGS PASS
Unattend.xmlMicrosoft-Windows-Shell-SetupoobeSystem
Sysprep.infGuiUnattendedN/A

Typpically used in the PreBootScript.wsf

The following example will set the password for the local administrator account to “My1stSecret”

Private Function IncludeScript(sScriptFile)
'...
End Function
'Begin
bStatus=True
If bStatus Then bStatus=IncludeScript("customlib.cis")
If bStatus Then bStatus=IncludeLibrary("Capalib.cin")
If bStatus Then bStatus=IncludeLibrary("Osdlib.cin")
If bStatus Then bStatus=Job_Start("WS","Script Name","1.0","ScriptName.log","INSTALL")
If bStatus Then bStatus=OSD_Initialize()
If bStatus Then bStatus=Sysprep_SetLocalAdminPassword("My1stSecret")
Job_End(bStatus)
'End main

Scripting Guidelines