Share via


BDD 2007 - Tips and Tricks - List of utility functions

 

When creating your own script to use with BDD it is a good idea to leverage the framework that BDD provides. See my previous blog about how to leverage these functions.

To make this process a little easier on myself I have created the following list which defines the functions that BDD provides, hopefully you will find this as useful as I have.

The first list defines the useful functions that are available via the oUtility object created by ZTIUtility.vbs:

LocalRootPath() – Returns the path of the root folder

LogPath() – Returns the path to the logs folder

ScriptName() – Returns the name of the current script

BootDevice() – Returns the system boot device

StatePath() – Returns the path of the state store, eg C:\MININT\StateStore

ScriptDir() – Returns the directory of the current script

ReadIni(file, section, item) – Reads the specified item from an ini file

WriteIni( file, section, item, myvalue ) – Writes the specified item to an ini file

Sections(file) – Reads the sections in an ini file and stores them in an object

SectionContents(file, section) – Reads the contents of the specified section and stores them in an object

RunWithHeartbeat(sCmd) – Runs command will providing heartbeat information to logs

ComputerName() – Determines the computer name to use for the build process

FindFile(sFilename, sFoundPath) – Returns the location of a file by looking in a number of standard locations

FindMappedDrive(sServerUNC) – Checks to see if a drive is mapped to the specified UNC path and returns the driver letter

ValidateConnection(sServerUNC) – Checks you are connected to the server if not then it will try to connect

MapNetworkDrive(sShare, sDomID, sDomPwd) - Maps a drive letter to the sShare UNC path, returns the drive letter, example: "C:", otherwise returns an error string

VerifyPathExists(strPath) – Verifies if the specified path exists, returns TRUE if path exists

There is also another script that can be referenced for disk utilities, this is called ZTIDiskUtility.vbs. These functions are not class based but can be referenced directly.

GetDiskSize(iDrive) – Returns the size of the specified disk

GetPartitionSize(sDriveLetter) – Returns the size of the specified partition

GetDiskPartitionCount(iDrive) – Returns the number of partitions on a disk, will also log the size of the partitions

GetDiskFreeSpace(iDrive) – Returns the free space available on the specified disk

GetNotActiveDrive() – Returns the active drive

GetBootDrive() – Returns the boot partition

MatchPartitionConfiguration(iDriveIndex, iPartitionIndex, sDriveLetter, iMinSizeMB) - Determine drive status as compared to the custom partition config, return codes are - 0 = Partition exists and meets criteria, 1 = Partition exists and does not meet the criteria, -1= Partition does not exist.

Disclaimer: The information on this site is provided "AS IS" with no warranties, confers no rights, and is not supported by the authors or Microsoft Corporation. Use of included script samples are subject to the terms specified in the Terms of Use .

Comments

  • Anonymous
    January 01, 2003
    Ben, thank you for posting all this valuable information.  Best blog BDD 2k7 site!!