# Sysprep_AddRunCommand

> Adds a command to unattend file that Windows MiniSetup should execute once durring the final phase.

Source: https://docs.capaone.com/capainstaller/vb-scripting-library/osd-scripting-library/sysprep-functions-osd/sysprep-addruncommand/  
Product: CapaInstaller — a separate CapaSystems product; do not apply this page to any other.

[VB Scripting Library](/capainstaller/vb-scripting-library/) > [OSD Scripting Library](/capainstaller/vb-scripting-library/osd-scripting-library/) > [Sysprep functions (OSD)](/capainstaller/vb-scripting-library/osd-scripting-library/sysprep-functions-osd/)

### Sysprep_AddRunCommand(sDescription,sCommand)

Adds a command to unattend file that Windows MiniSetup should execute once durring the final phase.  
You can run any application or script accessible on the local computer or on the network.

### Arguments

| ARGUMENT     | DESCRIPTION                                                          | TYPE   |
|:-------------|:---------------------------------------------------------------------|:-------|
| sDescription | A description for the run command, this is only used in unattend.xml | String |
| sCommand     | The command that needs to be executed                                | String |

### Return Type

Boolean, TRUE if function completed successfully.

### Affected unattend sections

| UNATTEND FILE                      | COMPONENT PATH / SECTION     | SETTINGS PASS   |
|:-----------------------------------|:-----------------------------|:----------------|
| Unattend.xml                       | Microsoft-Windows-Deployment | Specialize      |
| C:\Sysprep\i386\$oem$\cmdlines.txt | New line                     | N/A             |

### Remarks

Typpically used in the PreBootScript.wsf

### Example

The following example will add the command to enable the administrator account.

**VBScript**

```vb
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()
  
  sCmd="c:\windows\System32\cmd.exe /c net user administrator /active:yes"
  sDesc="Enable Administrator Account"
  
  If bStatus Then bStatus=Sysprep_AddRunCommand(sDesc,sCmd)

  Job_End(bStatus)
'End main

```

### See Also

[Scripting Guidelines](/capainstaller/vb-scripting-library/scripting-guidelines/) [Constants](/capainstaller/vb-scripting-library/addendum/constants/) [Package Property](/capainstaller/vb-scripting-library/addendum/package-property/) [Variables](/capainstaller/vb-scripting-library/addendum/variables/)
