Next Topic

Previous Topic

Book Contents

getRegistryValue() / get64BitRegistryValue

Warning: Certain registry locations require 64-Bit Commands for 64-bit Windows machines.

After entering the registry path, the value contained in the key is returned. A check can be made for existence, absence, equality, or size differences. For example, HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\AppPaths\AgentMon.exe\path contains the directory path identifying where the agent is installed on the target machine. The test determines if the value stored for this key exists, thereby verifying the agent is installed.

The available tests are:

Using the Backslash Character (\)

A backslash character \ at the end of the key returns the default value of that key. HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\WORDPAD.EXE\ returns a default value, such as %ProgramFiles%\Windows NT\Accessories\WORDPAD.EXE

The last single backslash in a string is used to delimit the registry key from the registry value. To include backslashes as part of the value string, specify double slashes for each slash character. For example, the string HKEY_LOCAL_MACHINE\SOFTWARE\SomeKey\Value\\Name is interpreted as the key HKEY_LOCAL_MACHINE\SOFTWARE\SomeKey with a value of Value\Name.

Example

if isUserLoggedIn(" ")
	getVariable("Registry Value", "HKEY_CURRENT_USER\KaseyaAgent-HKCUTest\TestREG_DWORD", "regDWORD", "All Operating Systems, "Halt on Fail"