Skip to content

Add unit to reinstall

Sets up a computer for reinstall with OS Deployment.

To find the IDs of the OS Point, OS Server, image, disk configuration, and installation type, use the OS Deployment functions, for example Get OS points and Get OS images.

AddUnitToReinstall(ByVal ComputerName As String, ByVal OSpointID As Integer, ByVal OSserverID As Integer, ByVal OSImageID As Integer, ByVal DiskConfigID As Integer, Optional ByVal InstallTypeID As Integer = 0, Optional ByVal NewUnitName As String = “”, Optional ByVal ReinstallMode As String = “Silent”, Optional ByVal Active As Boolean = True, Optional ByVal UnlinkAllPackagesAndGroups As Boolean = False, Optional ByVal UnlinkAllAdvPackages As Boolean = False, Optional ByVal ChangelogComment As String = “”, Optional ByVal ReinstallStartDate As String = “”, Optional ByVal CustomField1 As String = “”, Optional ByVal CustomField2 As String = “”) As Boolean

ComputerName (String)

The name or UUID of the computer

OSpointID (Integer)

The OS Point ID

OSserverID (Integer)

The OS Server ID

OSImageID (Integer)

OS Image ID

DiskConfigID (Integer)

The Disk Configuration ID

InstallTypeID (Integer)

The Install Type ID

This parameter is optional. If you omit it or specify 0, no installation type is set.

NewUnitName (String)

The new name of the unit. This parameter is optional, and if omitted, the unit will keep the existing name. If another computer already has the new name, the function returns False.

ReinstallMode (String)

The reinstall can be initialized in three ways:

  • “Silent”
  • “AlwaysConfirm”
  • “ConfirmOnlyIfUserLoggedOn”

This parameter is optional. The default value is “Silent”

Active (Boolean)

Whether the reinstall is activated. If False, the reinstall settings are saved, but the reinstall doesn’t start until it’s activated.

This parameter is optional. The default value is True.

UnlinkAllPackagesAndGroups (Boolean)

Whether all packages and groups should be unlinked. If True, advertised packages are also unlinked.

This parameter is optional. The default value is False.

UnlinkAllAdvPackages (Boolean)

Whether all advertised packages should be unlinked

This parameter is optional. The default value is False.

ChangelogComment (String)

The changelog comment for the change

This parameter is optional. The default value is “”.

ReinstallStartDate (String)

The reinstall start date in the format “yyyy-MM-dd HH:mm”, for example “2015-04-15 12:05”

yyyy - Year with century.
MM - Numeric month with a leading zero.
dd - Numeric day of the month with a leading zero.
HH - 24 Hour clock with leading zero.
mm - Minutes with leading zero.

This parameter is optional. The default value is “”, which doesn’t set a schedule for the reinstall. The reinstall then starts at the next agent run. If the date isn’t in the correct format, the function fails.

CustomField1 (String)

The value of CustomField1 in OS Deployment

This parameter is optional. The default value is “”.

CustomField2 (String)

The value of CustomField2 in OS Deployment

This parameter is optional. The default value is “”.

Boolean. The function returns True if successful, otherwise false.

Set oCMS = CreateObject("CapaInstaller.SDK")
wscript.echo oCMS.SetInstanceManagementPoint("1")
wscript.echo oCMS.AddUnitToReinstall("Klient","1","1","3","2","1","KlientNew","AlwaysConfirm",True,False,False,"comment")

With Schedule

Set oCMS = CreateObject("CapaInstaller.SDK")
wscript.echo oCMS.SetInstanceManagementPoint("1")
wscript.echo oCMS.AddUnitToReinstall("Klient","1","1","3","2","1","KlientNew","AlwaysConfirm",True,False,False,"comment","2015-05-05 12:00")

With CustomFields

Set oCMS = CreateObject("CapaInstaller.SDK")
wscript.echo oCMS.SetInstanceManagementPoint("1")
wscript.echo oCMS.AddUnitToReinstall("Klient","1","1","3","2","1","KlientNew","AlwaysConfirm",True,False,False,"comment","", "CustomField1Value", "CustomField2Value")

or if the unit has to keep the same name:

wscript.echo oCMS.AddUnitToReinstall("Klient","1","1","3","2","1")