com.ibm.jsdt.support.deploymenthelper
Class WindowsDeploymentHelper

java.lang.Object
  extended by com.ibm.jsdt.common.Base
      extended by com.ibm.jsdt.support.deploymenthelper.DeploymentHelper
          extended by com.ibm.jsdt.support.deploymenthelper.WindowsDeploymentHelper

public class WindowsDeploymentHelper
extends DeploymentHelper

Windows specific helper functionality.


Field Summary
static java.lang.String copyright
           
static int HKEY_CLASSES_ROOT
           
static int HKEY_CURRENT_CONFIG
           
static int HKEY_CURRENT_USER
           
static int HKEY_LOCAL_MACHINE
           
static int HKEY_USERS
           
 
Fields inherited from class com.ibm.jsdt.support.deploymenthelper.DeploymentHelper
DEPLOYER_SPECIFICATION_VERSION_KEY, ENTRY_STAGE, EXIT_STAGE, FAILURE, ISMP_GLOBAL_PROPERTY, ISMP_PRODUCT_PROPERTY, ISMP_WIZARD_PROPERTY, MAIN_STAGE, PDC_CANCEL_INSTALL, PDC_DO_NOT_INSTALL, PDC_DOES_NOT_EXIST, PDC_EXISTS, resourceBundle, SELECTED_TASK_NAMES_KEY, sNEWLN, SUCCESS, VERSIONCHECKER_STAGE, VPD_INSTALL_LOCATION_PIPE, VPD_VERSION_PIPE
 
Fields inherited from class com.ibm.jsdt.common.Base
NEW_LINE, OS_NAME, SLASH
 
Constructor Summary
WindowsDeploymentHelper()
           
 
Method Summary
static boolean addLocalUser(java.lang.String userName, java.lang.String password)
          Creates a new user ID and password.
static boolean addUser(java.lang.String userName, java.lang.String password, java.lang.String groupName)
          Creates a new user ID.
static boolean addUserToGroup(java.lang.String userName, java.lang.String groupName)
          Adds a user to a group.
static boolean createRegistryKey(int key, java.lang.String subKey)
          Creates a registry key.
static boolean createRegistryKey32(int key, java.lang.String subKey)
          Creates a registry key.
static boolean createRegistryKey64(int key, java.lang.String subKey)
          Creates a registry key.
static int createWindowsUser(java.lang.String userName, java.lang.String password)
          Creates a new user ID and password.
static boolean deleteRegistryKey(int key, java.lang.String subKey)
          Deletes a registry key (and any subkeys).
static boolean deleteRegistryKey32(int key, java.lang.String subKey)
          Deletes a registry key (and any subkeys).
static boolean deleteRegistryValueField(int key, java.lang.String subKey, java.lang.String value)
          Deletes a value name/field under a key.
static boolean deleteRegistryValueField32(int key, java.lang.String subKey, java.lang.String value)
          Deletes a value name/field under a key.
static boolean deleteRegistryValueField64(int key, java.lang.String subKey, java.lang.String value)
          Deletes a value name/field under a key.
static boolean doesRegKeyExist(int key, java.lang.String subKey)
          Checks for the existence of a particular subkey in the Windows registry.
static boolean doesRegKeyExist32(int key, java.lang.String subKey)
          Checks for the existence of a particular subkey in the Windows registry.
static boolean doesRegKeyExist64(int key, java.lang.String subKey)
          Checks for the existence of a particular subkey in the Windows registry.
static boolean doesUserIdExist(java.lang.String userName)
          Determines if the given user ID exists.
static java.lang.String getAdministratorsGroupName()
          Gets the administrator's group name.
static java.lang.String getIssResponseFileValue(java.lang.String responseFileName, java.lang.String section, java.lang.String key)
          Scans an ISS type response file for a key and returns the string value found.
static java.lang.String[] getRegistrySubkeys(int key, java.lang.String subKey)
          Retrieves a String[] of the names of the subkeys under a given registry key.
static java.lang.String[] getRegistrySubkeys32(int key, java.lang.String subKey)
          Retrieves a String[] of the names of the subkeys under a given registry key.
static java.lang.String[] getRegistrySubkeys64(int key, java.lang.String subKey)
          Retrieves a String[] of the names of the subkeys under a given registry key.
static java.lang.String getRegistryValue(int key, java.lang.String subKey, java.lang.String value)
          Gets a String from the Windows registry.
static java.lang.String getRegistryValue32(int key, java.lang.String subKey, java.lang.String value)
          Gets a String from the Windows registry.
static java.lang.String getRegistryValue64(int key, java.lang.String subKey, java.lang.String value)
          Gets a String from the Windows registry.
static int getRegistryValueInt(int key, java.lang.String subKey, java.lang.String value)
          Gets a number from the Windows registry.
static int getRegistryValueInt32(int key, java.lang.String subKey, java.lang.String value)
          Gets a number from the Windows registry.
static int getRegistryValueInt64(int key, java.lang.String subKey, java.lang.String value)
          Gets a number from the Windows registry.
static int getServicePack()
          Gets the Windows service pack level.
static java.lang.String getWinDir()
          Gets the Windows folder.
static java.util.List getWindowsDrives(java.lang.String compareVersion)
          Retrieves all of the drives on the Windows system.
static java.lang.String getWindowsShortPath(java.lang.String path)
          Retrieves the Windows short name path for the given path.
static java.lang.String getWindowsTempDirectoryPath()
          Retrieves the Windows temporary folder path associated with the current environment of the user program.
static int getWindowsVersion()
          Gets the current type of Windows operating system.
static void grantPrivilegesToUser(java.lang.String userName, java.util.List requestedPrivileges)
          Adds privileges to an existing user account on Microsoft Windows NT or later operating systems.
static boolean isNTFSDirectory(java.lang.String directory)
          Determines if the drive where a folder resides is formatted as an NTFS drive.
static boolean isNTFSDrive(java.lang.String windowsDrive)
          Indicates whether the specified drive is an NTFS formatted volume.
static boolean isUserAndPasswordValid(java.lang.String userName, java.lang.String password)
          Verifies if the given user and password are valid.
static boolean isWin2000()
          Confirms that the operating system is Windows 2000.
static boolean isWin2003()
          Confirms that the operating system is Windows 2003.
static boolean isWin2008()
          Confirms that the operating system is Windows Server 2008.
static boolean isWin95()
          Confirms that the operating system is Windows 95.
static boolean isWin98()
          Confirms that the operating system is Windows 98.
static boolean isWindows_64()
          Determine if the Windows machine is running 64-bit operating system
static boolean isWinNT40()
          Confirms that the operating system is Windows NT 4.0.
static boolean isWinVista()
          Confirms that the operating system is Windows Vista.
static boolean isWinXP()
          Confirms that the operating system is Windows XP.
protected static java.util.Map localeMap()
          Answers a mapping of locales to InstallShield response file language codes.
static int runAsWindowsSystemUser(java.lang.String localAdminUser, java.lang.String localAdminPassword, java.lang.String command)
          Runs the command on the local Windows computer as "SYSTEM".
static int runAsWindowsSystemUser(java.lang.String localAdminUser, java.lang.String localAdminPassword, java.lang.String command, boolean shouldLogOutput)
          Runs the command on the local Windows computer as "SYSTEM".
static void setIssResponseFileValue(java.lang.String responseFileName, java.lang.String section, java.lang.String key, java.lang.String keyValue)
          Scans an ISS type response file for a key and replaces the key value.
static boolean setRegistryNumericValue(int key, java.lang.String subKey, java.lang.String value, int sValue)
          Sets a registry number (int) value.
static boolean setRegistryNumericValue32(int key, java.lang.String subKey, java.lang.String valueKey, int valueData)
          Sets a registry number (int) value.
static boolean setRegistryNumericValue64(int key, java.lang.String subKey, java.lang.String valueKey, int valueData)
          Sets a registry number (int) value.
static boolean setRegistryStringValue(int key, java.lang.String subKey, java.lang.String value, java.lang.String sValue)
          Sets a registry string value.
static boolean setRegistryStringValue32(int key, java.lang.String subKey, java.lang.String valueKey, java.lang.String valueData)
          Sets a registry string value.
static boolean setRegistryStringValue64(int key, java.lang.String subKey, java.lang.String valueKey, java.lang.String valueData)
          Sets a registry string value.
static void setServiceTypeAutoStart(java.util.List requestedServices)
          Sets the start type of a Windows service to autostart.
static void setServiceTypeManualStart(java.util.List requestedServices)
          Sets the start type of a Windows service to manual.
static void startServices(java.util.List requestedServices)
          Starts a Windows service program.
static void stopServices(java.util.List requestedServices)
          Stops a Windows service program.
static boolean waitForFileOrRegKey(int timeOut, int interval, java.lang.String path, int key, java.lang.String subKey)
          Polls the system for the existence of a file, a registry key or both.
 
Methods inherited from class com.ibm.jsdt.support.deploymenthelper.DeploymentHelper
arraySearch, checkFreeSpaceAvailable, checkTargetDirectory, compareVersions, copyAndRenameFile, copyDirectory, copyFile, deleteFile, determineLogFileName, directorySearch, endOfFileScan, executeCommand, fileExists, fileGrep, fileLength, fileScan, fileSearchAndReplace, fileSearchAndReplaceLine, fileSearchAndReturnLinesWithSearch, getAgentRelease, getBackLevelDeployerMessage, getBackLevelJsdtMessage, getDeployerLocale, getDeploymentPackageJarName, getDeploymentWizardSpecificationVersion, getDomain, getEntryResponseFilePath, getEntryResponseFilePath, getExitResponseFilePath, getExitResponseFilePath, getGroupLocale, getHostName, getIbmNsiISMPPropValue, getIbmNsiProperties, getIbmnsiPropertyKeyPrefix, getIbmNsiPropValue, getIbmNsiPropValueByKey, getIimInstallLocationArray, getIimVersionArray, getKeyValue, getLogFileName, getLogger, getLogsDir, getMainResponseFilePath, getMainResponseFilePath, getOSType, getPartitionCapacity, getPartitionFileSystemType, getPartitionVolumeLabel, getPasswordValue, getPasswordValueByKey, getPreDeploymentCheckerResponseFilePath, getPreDeploymentCheckerResponseFilePath, getProductInstallingBundleProperties, getProductInstallingId, getProductInstallingVersion, getPropertyLogFileName, getQualifiedHostName, getQualifiedTiedPasswordValue, getQualifiedTiedVariableValue, getResourceString, getResponseFilePath, getResponseFilePath, getResponseFileProperties, getResponseFileProperty, getResponseFileValue, getSelectedTaskList, getSetupFileRemovalSetting, getStringFromCommandArray, getSystemEnvVar, getTaskApplicationList, getTaskHostnameList, getTempDir, getTiedPasswordValue, getTiedPasswordValueForKey, getTiedVariableValue, getTiedVariableValueForKey, getTranslatedMessage, getUnpackedDir, getVariableValueForTaskApplication, getVpdInstallLocationArray, getVpdPropertyList, getVpdVersionArray, isAix, isAixOSType, isApplicationVersionEqual, isEnoughTargetDirSpaceAvailable, isHPUX, isHPUXOSType, isIpv6Address, isLinux, isLinuxOSType, isLinuxX86_32, isLinuxX86_64, isOS400, isOS400OSType, isPortOpen, isPortRegistered, isPowerLinuxOSType, isSameDirectoryName, isSunOS, isSunOSType, isVersionSupported, isWindows, isWindowsOSType, log, log, logAppendFile, logAppendFile, logNewLine, logStatus, modifyResponseFile, postCompletionMessageToDeployerUI, postErrorMessageToDeployerMainUI, postErrorMessageToDeployerUI, postInformationMessageToDeployerMainUI, postInformationMessageToDeployerUI, postSuccessMessageToDeployerMainUI, postSuccessMessageToDeployerUI, postWarningMessageToDeployerMainUI, postWarningMessageToDeployerUI, readFile, removeAlphaCharsFromString, replaceSubstring, runAs, runAs, setIbmNsiProperty, setKeyValue, setLogFileName, setMainResources, setResponseFileProperty, setResponseFileValue, trace, trace, trace, trimDoubleQuotes, unPackJar, valueExists, waitForFile, writeFile
 
Methods inherited from class com.ibm.jsdt.common.Base
getBuildPropertiesAccessor, getFullVersion, getMainResources, getResourceString, getResourceString, getResourceString, getResourceString, getResourceString, getResourceStringArray, getResourceStringArray, showBuildProperties, showFullVersion
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

copyright

public static final java.lang.String copyright
See Also:
Constant Field Values

HKEY_LOCAL_MACHINE

public static final int HKEY_LOCAL_MACHINE
See Also:
Constant Field Values

HKEY_CLASSES_ROOT

public static final int HKEY_CLASSES_ROOT
See Also:
Constant Field Values

HKEY_USERS

public static final int HKEY_USERS
See Also:
Constant Field Values

HKEY_CURRENT_USER

public static final int HKEY_CURRENT_USER
See Also:
Constant Field Values

HKEY_CURRENT_CONFIG

public static final int HKEY_CURRENT_CONFIG
See Also:
Constant Field Values
Constructor Detail

WindowsDeploymentHelper

public WindowsDeploymentHelper()
Method Detail

localeMap

protected static java.util.Map localeMap()
Answers a mapping of locales to InstallShield response file language codes.

Returns:
A Map of Locales

isWin2000

public static boolean isWin2000()
Confirms that the operating system is Windows 2000.

Returns:
A boolean value of
  • true if the current OS is Windows 2000
  • false if the current OS is not Windows 2000

isWinXP

public static boolean isWinXP()
Confirms that the operating system is Windows XP.

Returns:
A boolean value of
  • true if the current OS is Windows XP
  • false if the current OS is not Windows XP

isWin2003

public static boolean isWin2003()
Confirms that the operating system is Windows 2003.

Returns:
A boolean value of
  • true if the current OS is Windows 2003
  • false if the current OS is not Windows 2003

isWinNT40

public static boolean isWinNT40()
Confirms that the operating system is Windows NT 4.0.

Returns:
A boolean value of
  • true if the current OS is Windows NT 4.0
  • false if the current OS is not Windows NT 4.0

isWin98

public static boolean isWin98()
Confirms that the operating system is Windows 98.

Returns:
A boolean value of
  • true if the current OS is Windows 98
  • false if the current OS is not Windows 98

isWinVista

public static boolean isWinVista()
Confirms that the operating system is Windows Vista.

Returns:
A boolean value of
  • true if the current OS is Windows Vista
  • false if the current OS is not Windows Vista

isWin2008

public static boolean isWin2008()
Confirms that the operating system is Windows Server 2008.

Returns:
A boolean value of
  • true if the current OS is Windows Server 2008
  • false if the current OS is not Windows Server 2008

isWin95

public static boolean isWin95()
Confirms that the operating system is Windows 95.

Returns:
A boolean value of
  • true if the current OS is Windows 95
  • false if the current OS is not Windows 95

getRegistryValue

public static java.lang.String getRegistryValue(int key,
                                                java.lang.String subKey,
                                                java.lang.String value)
Gets a String from the Windows registry.


There are 5 valid values for hKey:
1 = HKEY_LOCAL_MACHINE
2 = HKEY_CLASSES_ROOT
3 = HKEY_USERS
4 = HKEY_CURRENT_USER
5 = HKEY_CURRENT_CONFIG

Parameters:
key - - a Windows registry key
subKey - - a Windows registry subKey
value - - a Windows registry value. If it is not present for the key, it is added to the key.
Returns:
The value obtained from the Windows registry

getRegistryValue32

public static java.lang.String getRegistryValue32(int key,
                                                  java.lang.String subKey,
                                                  java.lang.String value)
Gets a String from the Windows registry.

Separate 32 bit and 64 bit registry API must be used on 64 bit versions of Windows Server 2008, Windows Vista, Windows Server 2003, and Windows XP. Starting with Windows 7 and Windows Server 2008 R2, the use of processor specific registry API for 64 bit platforms is no longer required. On 32 bit systems, both the generic registry API and the 32 bit registry API will succeed.


There are 5 valid values for hKey:
1 = HKEY_LOCAL_MACHINE
2 = HKEY_CLASSES_ROOT
3 = HKEY_USERS
4 = HKEY_CURRENT_USER
5 = HKEY_CURRENT_CONFIG

Parameters:
key - - a Windows registry key
subKey - - a Windows registry subKey
value - - a Windows registry value. If it is not present for the key, it is added to the key.
Returns:
The value obtained from the Windows registry

getRegistryValue64

public static java.lang.String getRegistryValue64(int key,
                                                  java.lang.String subKey,
                                                  java.lang.String value)
Gets a String from the Windows registry.

Separate 32 bit and 64 bit registry API must be used on 64 bit versions of Windows Server 2008, Windows Vista, Windows Server 2003, and Windows XP. Starting with Windows 7 and Windows Server 2008 R2, the use of processor specific registry API for 64 bit platforms is no longer required. On 32 bit systems, both the generic registry API and the 32 bit registry API will succeed.


There are 5 valid values for hKey:
1 = HKEY_LOCAL_MACHINE
2 = HKEY_CLASSES_ROOT
3 = HKEY_USERS
4 = HKEY_CURRENT_USER
5 = HKEY_CURRENT_CONFIG

Parameters:
key - - a Windows registry key
subKey - - a Windows registry subKey
value - - a Windows registry value. If it is not present for the key, it is added to the key.
Returns:
The value obtained from the Windows registry

getRegistryValueInt

public static int getRegistryValueInt(int key,
                                      java.lang.String subKey,
                                      java.lang.String value)
Gets a number from the Windows registry.

Separate 32 bit and 64 bit registry API must be used on 64 bit versions of Windows Server 2008, Windows Vista, Windows Server 2003, and Windows XP. Starting with Windows 7 and Windows Server 2008 R2, the use of processor specific registry API for 64 bit platforms is no longer required. On 32 bit systems, both the generic registry API and the 32 bit registry API will succeed.


There are 5 valid values for hKey:
1 = HKEY_LOCAL_MACHINE
2 = HKEY_CLASSES_ROOT
3 = HKEY_USERS
4 = HKEY_CURRENT_USER
5 = HKEY_CURRENT_CONFIG

Parameters:
key - - a Windows registry key
subKey - - a Windows registry subKey
value - - a Windows registry value. If it is not present for the key, it is added to the key.
Returns:
The number in the registry at the key

getRegistryValueInt32

public static int getRegistryValueInt32(int key,
                                        java.lang.String subKey,
                                        java.lang.String value)
Gets a number from the Windows registry.

Separate 32 bit and 64 bit registry API must be used on 64 bit versions of Windows Server 2008, Windows Vista, Windows Server 2003, and Windows XP. Starting with Windows 7 and Windows Server 2008 R2, the use of processor specific registry API for 64 bit platforms is no longer required. On 32 bit systems, both the generic registry API and the 32 bit registry API will succeed.


There are 5 valid values for hKey:
1 = HKEY_LOCAL_MACHINE
2 = HKEY_CLASSES_ROOT
3 = HKEY_USERS
4 = HKEY_CURRENT_USER
5 = HKEY_CURRENT_CONFIG

Parameters:
key - - a Windows registry key
subKey - - a Windows registry subKey
value - - a Windows registry value. If it is not present for the key, it is added to the key.
Returns:
The number in the registry at the key

getRegistryValueInt64

public static int getRegistryValueInt64(int key,
                                        java.lang.String subKey,
                                        java.lang.String value)
Gets a number from the Windows registry.

Separate 32 bit and 64 bit registry API must be used on 64 bit versions of Windows Server 2008, Windows Vista, Windows Server 2003, and Windows XP. Starting with Windows 7 and Windows Server 2008 R2, the use of processor specific registry API for 64 bit platforms is no longer required. On 32 bit systems, both the generic registry API and the 32 bit registry API will succeed.


There are 5 valid values for hKey:
1 = HKEY_LOCAL_MACHINE
2 = HKEY_CLASSES_ROOT
3 = HKEY_USERS
4 = HKEY_CURRENT_USER
5 = HKEY_CURRENT_CONFIG

Parameters:
key - - a Windows registry key
subKey - - a Windows registry subKey
value - - a Windows registry value. If it is not present for the key, it is added to the key.
Returns:
The number in the registry at the key

createRegistryKey

public static boolean createRegistryKey(int key,
                                        java.lang.String subKey)
Creates a registry key.

Separate 32 bit and 64 bit registry API must be used on 64 bit versions of Windows Server 2008, Windows Vista, Windows Server 2003, and Windows XP. Starting with Windows 7 and Windows Server 2008 R2, the use of processor specific registry API for 64 bit platforms is no longer required. On 32 bit systems, both the generic registry API and the 32 bit registry API will succeed.


There are 5 valid values for hKey:
1 = HKEY_LOCAL_MACHINE
2 = HKEY_CLASSES_ROOT
3 = HKEY_USERS
4 = HKEY_CURRENT_USER
5 = HKEY_CURRENT_CONFIG

Parameters:
key - - a Windows registry key
subKey - - a Windows registry subKey
Returns:
Aboolean value of
  • true if registry creation is successful
  • false otherwise

createRegistryKey32

public static boolean createRegistryKey32(int key,
                                          java.lang.String subKey)
Creates a registry key.

Separate 32 bit and 64 bit registry API must be used on 64 bit versions of Windows Server 2008, Windows Vista, Windows Server 2003, and Windows XP. Starting with Windows 7 and Windows Server 2008 R2, the use of processor specific registry API for 64 bit platforms is no longer required. On 32 bit systems, both the generic registry API and the 32 bit registry API will succeed.


There are 5 valid values for hKey:
1 = HKEY_LOCAL_MACHINE
2 = HKEY_CLASSES_ROOT
3 = HKEY_USERS
4 = HKEY_CURRENT_USER
5 = HKEY_CURRENT_CONFIG

Parameters:
key - - a Windows registry key
subKey - - a Windows registry subKey
Returns:
Aboolean value of
  • true if registry creation is successful
  • false otherwise

createRegistryKey64

public static boolean createRegistryKey64(int key,
                                          java.lang.String subKey)
Creates a registry key.

Separate 32 bit and 64 bit registry API must be used on 64 bit versions of Windows Server 2008, Windows Vista, Windows Server 2003, and Windows XP. Starting with Windows 7 and Windows Server 2008 R2, the use of processor specific registry API for 64 bit platforms is no longer required. On 32 bit systems, both the generic registry API and the 32 bit registry API will succeed.


There are 5 valid values for hKey:
1 = HKEY_LOCAL_MACHINE
2 = HKEY_CLASSES_ROOT
3 = HKEY_USERS
4 = HKEY_CURRENT_USER
5 = HKEY_CURRENT_CONFIG

Parameters:
key - - a Windows registry key
subKey - - a Windows registry subKey
Returns:
Aboolean value of
  • true if registry creation is successful
  • false otherwise

deleteRegistryKey

public static boolean deleteRegistryKey(int key,
                                        java.lang.String subKey)
Deletes a registry key (and any subkeys).

Note: ISAT cannot delete a 64 bit registry key on 64 bit versions of Windows Server 2008 R1, Windows Vista, Windows Server 2003, and Windows XP.


There are 5 valid values for hKey:
1 = HKEY_LOCAL_MACHINE
2 = HKEY_CLASSES_ROOT
3 = HKEY_USERS
4 = HKEY_CURRENT_USER
5 = HKEY_CURRENT_CONFIG

Parameters:
key - - Windows registry key
subKey - - Windows registry subKey
Returns:
@return Aboolean value of
  • true if registry deletion is successful
  • false otherwise

deleteRegistryKey32

public static boolean deleteRegistryKey32(int key,
                                          java.lang.String subKey)
Deletes a registry key (and any subkeys).

Note: ISAT cannot delete a 64 bit registry key on 64 bit versions of Windows Server 2008 R1, Windows Vista, Windows Server 2003, and Windows XP.


There are 5 valid values for hKey:
1 = HKEY_LOCAL_MACHINE
2 = HKEY_CLASSES_ROOT
3 = HKEY_USERS
4 = HKEY_CURRENT_USER
5 = HKEY_CURRENT_CONFIG

Parameters:
key - - Windows registry key
subKey - - Windows registry subKey
Returns:
@return Aboolean value of
  • true if registry deletion is successful
  • false otherwise

deleteRegistryValueField

public static boolean deleteRegistryValueField(int key,
                                               java.lang.String subKey,
                                               java.lang.String value)
Deletes a value name/field under a key.

Separate 32 bit and 64 bit registry API must be used on 64 bit versions of Windows Server 2008, Windows Vista, Windows Server 2003, and Windows XP. Starting with Windows 7 and Windows Server 2008 R2, the use of processor specific registry API for 64 bit platforms is no longer required. On 32 bit systems, both the generic registry API and the 32 bit registry API will succeed.


There are 5 valid values for hKey:
1 = HKEY_LOCAL_MACHINE
2 = HKEY_CLASSES_ROOT
3 = HKEY_USERS
4 = HKEY_CURRENT_USER
5 = HKEY_CURRENT_CONFIG

Parameters:
key - - Windows registry key
subKey - - Windows registry subKey
value - - Window registry value
Returns:
@return Aboolean value of
  • true if deletion is successful
  • false otherwise

deleteRegistryValueField32

public static boolean deleteRegistryValueField32(int key,
                                                 java.lang.String subKey,
                                                 java.lang.String value)
Deletes a value name/field under a key.

Separate 32 bit and 64 bit registry API must be used on 64 bit versions of Windows Server 2008, Windows Vista, Windows Server 2003, and Windows XP. Starting with Windows 7 and Windows Server 2008 R2, the use of processor specific registry API for 64 bit platforms is no longer required. On 32 bit systems, both the generic registry API and the 32 bit registry API will succeed.


There are 5 valid values for hKey:
1 = HKEY_LOCAL_MACHINE
2 = HKEY_CLASSES_ROOT
3 = HKEY_USERS
4 = HKEY_CURRENT_USER
5 = HKEY_CURRENT_CONFIG

Parameters:
key - - Windows registry key
subKey - - Windows registry subKey
value - - Window registry value
Returns:
@return Aboolean value of
  • true if deletion is successful
  • false otherwise

deleteRegistryValueField64

public static boolean deleteRegistryValueField64(int key,
                                                 java.lang.String subKey,
                                                 java.lang.String value)
Deletes a value name/field under a key.

Separate 32 bit and 64 bit registry API must be used on 64 bit versions of Windows Server 2008, Windows Vista, Windows Server 2003, and Windows XP. Starting with Windows 7 and Windows Server 2008 R2, the use of processor specific registry API for 64 bit platforms is no longer required. On 32 bit systems, both the generic registry API and the 32 bit registry API will succeed.


There are 5 valid values for hKey:
1 = HKEY_LOCAL_MACHINE
2 = HKEY_CLASSES_ROOT
3 = HKEY_USERS
4 = HKEY_CURRENT_USER
5 = HKEY_CURRENT_CONFIG

Parameters:
key - - Windows registry key
subKey - - Windows registry subKey
value - - Window registry value
Returns:
@return Aboolean value of
  • true if deletion is successful
  • false otherwise

setRegistryStringValue

public static boolean setRegistryStringValue(int key,
                                             java.lang.String subKey,
                                             java.lang.String value,
                                             java.lang.String sValue)
Sets a registry string value. If the value name already exists under the key, the value is updated. If the value name does not exist, it will be created and the value assigned to it.

Separate 32 bit and 64 bit registry API must be used on 64 bit versions of Windows Server 2008, Windows Vista, Windows Server 2003, and Windows XP. Starting with Windows 7 and Windows Server 2008 R2, the use of processor specific registry API for 64 bit platforms is no longer required. On 32 bit systems, both the generic registry API and the 32 bit registry API will succeed.


There are 5 valid values for hKey:
1 = HKEY_LOCAL_MACHINE
2 = HKEY_CLASSES_ROOT
3 = HKEY_USERS
4 = HKEY_CURRENT_USER
5 = HKEY_CURRENT_CONFIG

Parameters:
key - - Windows registry key
subKey - - Windows registry subKey
value - - Windows registry value
sValue - - value to be updated or created if it does not exist
Returns:
@return Aboolean value of
  • true if registry is updated successful
  • false otherwise

setRegistryStringValue32

public static boolean setRegistryStringValue32(int key,
                                               java.lang.String subKey,
                                               java.lang.String valueKey,
                                               java.lang.String valueData)
Sets a registry string value. If the value name already exists under the key, the value is updated. If the value name does not exist, it will be created and the value assigned to it.

Separate 32 bit and 64 bit registry API must be used on 64 bit versions of Windows Server 2008, Windows Vista, Windows Server 2003, and Windows XP. Starting with Windows 7 and Windows Server 2008 R2, the use of processor specific registry API for 64 bit platforms is no longer required. On 32 bit systems, both the generic registry API and the 32 bit registry API will succeed.


There are 5 valid values for hKey:
1 = HKEY_LOCAL_MACHINE
2 = HKEY_CLASSES_ROOT
3 = HKEY_USERS
4 = HKEY_CURRENT_USER
5 = HKEY_CURRENT_CONFIG

Parameters:
key - - Windows registry key
subKey - - Windows registry subKey
value - - Windows registry value
sValue - - value to be updated or created if it does not exist
Returns:
@return Aboolean value of
  • true if registry is updated successful
  • false otherwise

setRegistryStringValue64

public static boolean setRegistryStringValue64(int key,
                                               java.lang.String subKey,
                                               java.lang.String valueKey,
                                               java.lang.String valueData)
Sets a registry string value. If the value name already exists under the key, the value is updated. If the value name does not exist, it will be created and the value assigned to it.

Separate 32 bit and 64 bit registry API must be used on 64 bit versions of Windows Server 2008, Windows Vista, Windows Server 2003, and Windows XP. Starting with Windows 7 and Windows Server 2008 R2, the use of processor specific registry API for 64 bit platforms is no longer required. On 32 bit systems, both the generic registry API and the 32 bit registry API will succeed.


There are 5 valid values for hKey:
1 = HKEY_LOCAL_MACHINE
2 = HKEY_CLASSES_ROOT
3 = HKEY_USERS
4 = HKEY_CURRENT_USER
5 = HKEY_CURRENT_CONFIG

Parameters:
key - - Windows registry key
subKey - - Windows registry subKey
value - - Windows registry value
sValue - - value to be updated or created if it does not exist
Returns:
@return Aboolean value of
  • true if registry is updated successful
  • false otherwise

setRegistryNumericValue

public static boolean setRegistryNumericValue(int key,
                                              java.lang.String subKey,
                                              java.lang.String value,
                                              int sValue)
Sets a registry number (int) value. If the value name already exists under the key, the value is updated. If the value name does not exist, it will be created and the value assigned to it.

Separate 32 bit and 64 bit registry API must be used on 64 bit versions of Windows Server 2008, Windows Vista, Windows Server 2003, and Windows XP. Starting with Windows 7 and Windows Server 2008 R2, the use of processor specific registry API for 64 bit platforms is no longer required. On 32 bit systems, both the generic registry API and the 32 bit registry API will succeed.


There are 5 valid values for hKey:
1 = HKEY_LOCAL_MACHINE
2 = HKEY_CLASSES_ROOT
3 = HKEY_USERS
4 = HKEY_CURRENT_USER
5 = HKEY_CURRENT_CONFIG

Parameters:
key - - Windows registry key
subKey - - Windows registry subKey
value - - Windows registry value
sValue - - value to be updated or created if it does not exist
Returns:
@return Aboolean value of
  • true if registry is updated successful
  • false otherwise

setRegistryNumericValue32

public static boolean setRegistryNumericValue32(int key,
                                                java.lang.String subKey,
                                                java.lang.String valueKey,
                                                int valueData)
Sets a registry number (int) value. If the value name already exists under the key, the value is updated. If the value name does not exist, it will be created and the value assigned to it.

Separate 32 bit and 64 bit registry API must be used on 64 bit versions of Windows Server 2008, Windows Vista, Windows Server 2003, and Windows XP. Starting with Windows 7 and Windows Server 2008 R2, the use of processor specific registry API for 64 bit platforms is no longer required. On 32 bit systems, both the generic registry API and the 32 bit registry API will succeed.


There are 5 valid values for hKey:
1 = HKEY_LOCAL_MACHINE
2 = HKEY_CLASSES_ROOT
3 = HKEY_USERS
4 = HKEY_CURRENT_USER
5 = HKEY_CURRENT_CONFIG

Parameters:
key - - Windows registry key
subKey - - Windows registry subKey
value - - Windows registry value
sValue - - value to be updated or created if it does not exist
Returns:
@return Aboolean value of
  • true if registry is updated successful
  • false otherwise

setRegistryNumericValue64

public static boolean setRegistryNumericValue64(int key,
                                                java.lang.String subKey,
                                                java.lang.String valueKey,
                                                int valueData)
Sets a registry number (int) value. If the value name already exists under the key, the value is updated. If the value name does not exist, it will be created and the value assigned to it.

Separate 32 bit and 64 bit registry API must be used on 64 bit versions of Windows Server 2008, Windows Vista, Windows Server 2003, and Windows XP. Starting with Windows 7 and Windows Server 2008 R2, the use of processor specific registry API for 64 bit platforms is no longer required. On 32 bit systems, both the generic registry API and the 32 bit registry API will succeed.


There are 5 valid values for hKey:
1 = HKEY_LOCAL_MACHINE
2 = HKEY_CLASSES_ROOT
3 = HKEY_USERS
4 = HKEY_CURRENT_USER
5 = HKEY_CURRENT_CONFIG

Parameters:
key - - Windows registry key
subKey - - Windows registry subKey
value - - Windows registry value
sValue - - value to be updated or created if it does not exist
Returns:
@return Aboolean value of
  • true if registry is updated successful
  • false otherwise

addLocalUser

public static boolean addLocalUser(java.lang.String userName,
                                   java.lang.String password)
Creates a new user ID and password.

Parameters:
userName - - a user name
password - - a password
Returns:
a boolean
  • true if user ID and password are successfully created
  • false otherwise

addUser

public static boolean addUser(java.lang.String userName,
                              java.lang.String password,
                              java.lang.String groupName)
Creates a new user ID.

Parameters:
userName - - a user name
password - - password
groupName - - group name to add user to
Returns:
a boolean
  • true if user id is successfully created
  • false otherwise

addUserToGroup

public static boolean addUserToGroup(java.lang.String userName,
                                     java.lang.String groupName)
Adds a user to a group.

Parameters:
userName - - a user name
groupName - - group name to add user to
Returns:
a boolean
  • true if user id is successfully added to the group
  • false otherwise

getServicePack

public static int getServicePack()
Gets the Windows service pack level.

Returns:
The current Windows service pack level number

doesRegKeyExist

public static boolean doesRegKeyExist(int key,
                                      java.lang.String subKey)
Checks for the existence of a particular subkey in the Windows registry.

Separate 32 bit and 64 bit registry API must be used on 64 bit versions of Windows Server 2008, Windows Vista, Windows Server 2003, and Windows XP. Starting with Windows 7 and Windows Server 2008 R2, the use of processor specific registry API for 64 bit platforms is no longer required. On 32 bit systems, both the generic registry API and the 32 bit registry API will succeed.

There are 5 valid values for setRegistryKey:
HKEY_LOCAL_MACHINE = 1;
HKEY_CLASSES_ROOT = 2;
HKEY_USERS = 3;
HKEY_CURRENT_USER = 4;
HKEY_CURRENT_CONFIG = 5;

The registry subkey should be a string containing the full key path of the subkey. You must use double backslashes ("\\") as subkey delimiters.
Example:
"SOFTWARE\\IBM\\DB2\\DB2 Workgroup Edition\\CurrentVersion"

Parameters:
key - - Windows registry key
subKey - - Widows registry subKey
Returns:
A boolean value of
  • true if registry key exists
  • false otherwise

doesRegKeyExist32

public static boolean doesRegKeyExist32(int key,
                                        java.lang.String subKey)
Checks for the existence of a particular subkey in the Windows registry.

Separate 32 bit and 64 bit registry API must be used on 64 bit versions of Windows Server 2008, Windows Vista, Windows Server 2003, and Windows XP. Starting with Windows 7 and Windows Server 2008 R2, the use of processor specific registry API for 64 bit platforms is no longer required. On 32 bit systems, both the generic registry API and the 32 bit registry API will succeed.

There are 5 valid values for setRegistryKey:
HKEY_LOCAL_MACHINE = 1;
HKEY_CLASSES_ROOT = 2;
HKEY_USERS = 3;
HKEY_CURRENT_USER = 4;
HKEY_CURRENT_CONFIG = 5;

The registry subkey should be a string containing the full key path of the subkey. You must use double backslashes ("\\") as subkey delimiters.
Example:
"SOFTWARE\\IBM\\DB2\\DB2 Workgroup Edition\\CurrentVersion"

Parameters:
key - - Windows registry key
subKey - - Widows registry subKey
Returns:
A boolean value of
  • true if registry key exists
  • false otherwise

doesRegKeyExist64

public static boolean doesRegKeyExist64(int key,
                                        java.lang.String subKey)
Checks for the existence of a particular subkey in the Windows registry.

Separate 32 bit and 64 bit registry API must be used on 64 bit versions of Windows Server 2008, Windows Vista, Windows Server 2003, and Windows XP. Starting with Windows 7 and Windows Server 2008 R2, the use of processor specific registry API for 64 bit platforms is no longer required. On 32 bit systems, both the generic registry API and the 32 bit registry API will succeed.

There are 5 valid values for setRegistryKey:
HKEY_LOCAL_MACHINE = 1;
HKEY_CLASSES_ROOT = 2;
HKEY_USERS = 3;
HKEY_CURRENT_USER = 4;
HKEY_CURRENT_CONFIG = 5;

The registry subkey should be a string containing the full key path of the subkey. You must use double backslashes ("\\") as subkey delimiters.
Example:
"SOFTWARE\\IBM\\DB2\\DB2 Workgroup Edition\\CurrentVersion"

Parameters:
key - - Windows registry key
subKey - - Widows registry subKey
Returns:
A boolean value of
  • true if registry key exists
  • false otherwise

getWinDir

public static java.lang.String getWinDir()
Gets the Windows folder.

Returns:
The Windows folder

waitForFileOrRegKey

public static boolean waitForFileOrRegKey(int timeOut,
                                          int interval,
                                          java.lang.String path,
                                          int key,
                                          java.lang.String subKey)
Polls the system for the existence of a file, a registry key or both. Pauses the current thread for the specified number of seconds each time the specified file or registry key is not found.

The purpose of this function is to allow synchronization of a deployment accelerator's installation program with the particular product's installation program. The creation of a particular file or registry key can be taken as an indicator that the installation routine for a product is complete.

Parameters:
timeOut - - time to wait in seconds (-1 for infinite timeout)
interval - - a poll time frame interval in seconds
path - - a path for specify file (can be null)
key - - Windows registry key
subKey - - Windows registry subKey
Returns:
a boolean value of
  • true if the file is found (created) or the registry key is found (created)
  • false otherwise

getWindowsVersion

public static int getWindowsVersion()
Gets the current type of Windows operating system.

Returns:
An integer indicating the type of operating system as follows.
    0 = Windows 95
    1 = Windows 95OSR2
    2 = Windows 98
    10 = Windows NT version 3.51
    11 = Windows NT version 4.0
    12 = Windows 2000

getIssResponseFileValue

public static java.lang.String getIssResponseFileValue(java.lang.String responseFileName,
                                                       java.lang.String section,
                                                       java.lang.String key)
Scans an ISS type response file for a key and returns the string value found.

Parameters:
responseFileName - - response file name
section - - section of response file name, can be ""
key - - response file key
Returns:
The value found at the key

setIssResponseFileValue

public static void setIssResponseFileValue(java.lang.String responseFileName,
                                           java.lang.String section,
                                           java.lang.String key,
                                           java.lang.String keyValue)
Scans an ISS type response file for a key and replaces the key value.

Parameters:
responseFileName - - response file name
section - - section of response file name, can be ""
key - - response file key
keyValue - - a new value to replace the current key value.

doesUserIdExist

public static boolean doesUserIdExist(java.lang.String userName)
Determines if the given user ID exists.

Parameters:
userName - - a user name
Returns:
A boolean value of
  • true if user ID is found
  • false otherwise

grantPrivilegesToUser

public static void grantPrivilegesToUser(java.lang.String userName,
                                         java.util.List requestedPrivileges)
Adds privileges to an existing user account on Microsoft Windows NT or later operating systems.


Constants for some common user privileges follow. See your Microsoft documentation for additional privileges.
Log on as a service = SeServiceLogonRight
Create a token object = SeCreateTokenPrivilege
Increase quotas = SeIncreaseQuotaPrivilege
Replace process level token = SeAssignPrimaryTokenPrivilege
Act as a part of the operating system = SeTcbPrivilege

Parameters:
userName - - a user name
requestedPrivileges - - a list of requested privilege for that user

isUserAndPasswordValid

public static boolean isUserAndPasswordValid(java.lang.String userName,
                                             java.lang.String password)
Verifies if the given user and password are valid.

Parameters:
userName - - a user name
password - - a password
Returns:
A boolean value of
  • true if user and password are valid.
  • false otherwise

getAdministratorsGroupName

public static java.lang.String getAdministratorsGroupName()
Gets the administrator's group name.

Returns:
The group name

stopServices

public static void stopServices(java.util.List requestedServices)
Stops a Windows service program.

Parameters:
requestedServices - - list of the services that need to be stopped.

startServices

public static void startServices(java.util.List requestedServices)
Starts a Windows service program.

Parameters:
requestedServices - - list of the services that need to be started

setServiceTypeManualStart

public static void setServiceTypeManualStart(java.util.List requestedServices)
Sets the start type of a Windows service to manual.

Parameters:
requestedServices - - List of services to be started manually

setServiceTypeAutoStart

public static void setServiceTypeAutoStart(java.util.List requestedServices)
Sets the start type of a Windows service to autostart.

Parameters:
requestedServices - - List of services to be started automatically

getWindowsShortPath

public static java.lang.String getWindowsShortPath(java.lang.String path)
Retrieves the Windows short name path for the given path. If the specified path does not exist on the system, this method returns null .

Parameters:
path - - a file or directory name path
Returns:
The short version of the path.

getWindowsTempDirectoryPath

public static java.lang.String getWindowsTempDirectoryPath()
Retrieves the Windows temporary folder path associated with the current environment of the user program.

A slash will be appended to the path.

Returns:
A String indicating the path for the temporary folder

getRegistrySubkeys

public static java.lang.String[] getRegistrySubkeys(int key,
                                                    java.lang.String subKey)
Retrieves a String[] of the names of the subkeys under a given registry key. The names are unqualified.

Separate 32 bit and 64 bit registry API must be used on 64 bit versions of Windows Server 2008, Windows Vista, Windows Server 2003, and Windows XP. Starting with Windows 7 and Windows Server 2008 R2, the use of processor specific registry API for 64 bit platforms is no longer required. On 32 bit systems, both the generic registry API and the 32 bit registry API will succeed.

If no subkeys are present, null is returned.

Parameters:
key - - The full key path under the hive (parent key)
subKey - - the subKey path You must use double backslashes ("\\") as subkey delimiters. Example: "SOFTWARE\\IBM\\DB2\\DB2 Workgroup Edition\\CurrentVersion"
Returns:
A String[] listing of subkeys.

getRegistrySubkeys32

public static java.lang.String[] getRegistrySubkeys32(int key,
                                                      java.lang.String subKey)
Retrieves a String[] of the names of the subkeys under a given registry key. The names are unqualified.

Separate 32 bit and 64 bit registry API must be used on 64 bit versions of Windows Server 2008, Windows Vista, Windows Server 2003, and Windows XP. Starting with Windows 7 and Windows Server 2008 R2, the use of processor specific registry API for 64 bit platforms is no longer required. On 32 bit systems, both the generic registry API and the 32 bit registry API will succeed.

If no subkeys are present, null is returned.

Parameters:
key - - The full key path under the hive (parent key)
subKey - - the subKey path You must use double backslashes ("\\") as subkey delimiters. Example: "SOFTWARE\\IBM\\DB2\\DB2 Workgroup Edition\\CurrentVersion"
Returns:
A String[] listing of subkeys.

getRegistrySubkeys64

public static java.lang.String[] getRegistrySubkeys64(int key,
                                                      java.lang.String subKey)
Retrieves a String[] of the names of the subkeys under a given registry key. The names are unqualified.

Separate 32 bit and 64 bit registry API must be used on 64 bit versions of Windows Server 2008, Windows Vista, Windows Server 2003, and Windows XP. Starting with Windows 7 and Windows Server 2008 R2, the use of processor specific registry API for 64 bit platforms is no longer required. On 32 bit systems, both the generic registry API and the 32 bit registry API will succeed.

If no subkeys are present, null is returned.

Parameters:
key - - The full key path under the hive (parent key)
subKey - - the subKey path You must use double backslashes ("\\") as subkey delimiters. Example: "SOFTWARE\\IBM\\DB2\\DB2 Workgroup Edition\\CurrentVersion"
Returns:
A String[] listing of subkeys.

isNTFSDrive

public static boolean isNTFSDrive(java.lang.String windowsDrive)
Indicates whether the specified drive is an NTFS formatted volume.

The specified drive must be a letter appended with a colon and, optionally, a backslash. For example: "C:" or "C:\".

Parameters:
windowsDrive - - Windows drive name.
Returns:
a boolean
  • true if window drive is NTFS formatted volume.
  • false otherwise

getWindowsDrives

public static java.util.List getWindowsDrives(java.lang.String compareVersion)
Retrieves all of the drives on the Windows system.

If this method is called on IBM Installation Agents with specifications prior to 2.1.1.0, an empty List is returned.

Parameters:
compareVersion - - the product version to be compared to the current version
Returns:
List of Windows drives

createWindowsUser

public static int createWindowsUser(java.lang.String userName,
                                    java.lang.String password)
Creates a new user ID and password.

Returns a native int system return code. Some relevant possible return values are: Success 1 The user name parameter is not valid. 2202 The password parameter is not valid. 2203 The user account already exists. 2224 The password is shorter than required. 2245

Parameters:
userName - - a user name
password - - user password
Returns:
A int return code.

isNTFSDirectory

public static boolean isNTFSDirectory(java.lang.String directory)
Determines if the drive where a folder resides is formatted as an NTFS drive.

Parameters:
directory - - a drive directory
Returns:
A boolean value of
  • true if the drive where the folder resides is formatted as an NTFS drive
  • false if the folder string is null, zero length, or does not contain a drive letter

runAsWindowsSystemUser

public static int runAsWindowsSystemUser(java.lang.String localAdminUser,
                                         java.lang.String localAdminPassword,
                                         java.lang.String command)
Runs the command on the local Windows computer as "SYSTEM". The access user must be a member of the local Administrators group.

Type Parameters:
code - String The user ID that belongs to the local Administrators group
code - String password
code - String command
Returns:
int the return code of the command.

runAsWindowsSystemUser

public static int runAsWindowsSystemUser(java.lang.String localAdminUser,
                                         java.lang.String localAdminPassword,
                                         java.lang.String command,
                                         boolean shouldLogOutput)
Runs the command on the local Windows computer as "SYSTEM". The access user must be a member of the local Administrators group.

Type Parameters:
code - String The user ID that belongs to the local Administrators group
code - String password
code - String command
code - boolean turn command output logging on/off
Returns:
int the return code of the command.

isWindows_64

public static boolean isWindows_64()
Determine if the Windows machine is running 64-bit operating system

Returns:
boolean