NI System Configuration API Reference for LabWindows™/CVI™

NISysCfgSetSystemImageFromFolder2

  • Updated2023-02-21
  • 3 minute(s) read

NISysCfgStatus NISysCfgSetSystemImageFromFolder2( NISysCfgSessionHandle sessionHandle, NISysCfgBool autoRestart, const char [] sourceFolder, const char [] encryptionPassphrase, unsigned int numBlacklistEntries, const char ** blacklistFilesDirectories, NISysCfgBool originalSystemOnly, NISysCfgNetworkInterfaceSettings networkSettings );

Purpose

Applies a system image folder—a copy of the contents and software on the primary hard drive of a specified target system. Applying the image to the system restores it to the state captured in the image you create with NISysCfgCreateSystemImageAsFolder.

Parameters

Input
Name Type Description
sessionHandle NISysCfgSessionHandle Specifies the system handle for the system receiving the image.
autoRestart NISysCfgBool Restarts the system into install mode by default before the operation is performed, and restarts back to a running state after the operation is complete. If you choose not to restart automatically, and the system is not in install mode, the resulting image may not be valid.
sourceFolder const char [] Specifies the name and location of the target disk image folder on the local computer.
encryptionPassphrase const char [] A passphrase used to encrypt a portion of the image that contains sensitive information.
numBlacklistEntries unsigned int Specifies the number of files and/or in blacklistFilesDirectories.
blacklistFilesDirectories const char ** Specifies the list of files and folders to exclude from the target image. Files on the blacklist will not be copied from the image to the target and they will not be removed from the target.

Example
originalSystemOnly NISysCfgBool Verifies that the target system has the same MAC address as the system from which the image was originally created. Selecting TRUE will allow you to restore an image from the exact same target from which the image was created only. This option is FALSE by default. When the option is FALSE, this operation can also apply the system image to other targets of the same device class.
networkSettings NISysCfgNetworkInterfaceSettings Applies all network settings from the image to all network adapters by default.
NISysCfgResetPrimaryDisableOthers (0)

Resets the primary network adapter and disables all other network adapters. The network settings from the image are ignored.

NISysCfgPreservePrimaryDisableOthers (1)

Preserves the existing settings on the primary network adapter and disables all other network adapters. The network settings from the image are ignored.

NISysCfgPreservePrimaryPreserveOthers (2)

Preserves the settings for all network adapters. The network settings from the image are ignored.

NISysCfgPreservePrimaryApplyOthers (3)

Preserves the settings for the primary network adapter on the target and applies the settings from the image to all other network devices.

NISysCfgApplyPrimaryDisableOthers (4)

Applies the settings from the image to the primary network adapter on the target and disables all other network adapters.

NISysCfgApplyPrimaryPreserveOthers (5)

Applies the settings from the image to the primary network adapter on the target and preserves the existing settings for all other network adapters.

NISysCfgApplyPrimaryApplyOthers (6)

Applies all network settings from the image to all network adapters.

Return Value

Name Type Description
returnValue NISysCfgStatus The error code returned by the function in the event of an error or warning. A value of 0 indicates success. A positive value indicates a warning. A negative value indicates an error. Refer to Status Codes or nisyscfg_errors.h for details regarding error codes.

Example

This example applies to the blacklistFilesDirectories parameter. For this example, consider the following scenario:

  • The image contains files A, B,C, D.
  • The target contains files A, B, E, F.
  • The user blacklist contains files A, C, E, G.
Results
  • File A on the target is not modified despite being in the image because it is in the blacklist.
  • File B from the image is written over the one on the target.
  • File C from the image is not written to the target because it is in the blacklist.
  • File D from the image is written to the target.
  • File E on the target is not part of the image but is not deleted because it is in the blacklist.
  • File F on the target gets deleted because it is not part of the image.
  • File G in the blacklist is ignored because it is part of neither the image nor the target.