MDT Utility 函数
函数名 | 描述 |
oUtility.LocalRootPath | Returns the path of the root folder being used by the deployment process on the target computer—for example, C:\MININT |
oUtility.BootDevice | Returns the system boot device—for example, MULTI(0)DISK(0)RDISK(0)PARTITION(1) |
oUtility.LogPath | Returns the path to the logs folder being used during the deployment—for example, C:\MININT\SMSOSD\OSDLOGS |
oUtility.StatePath | Returns the path of the currently configured state store—for example, C:\MININT\StateStore |
oUtility.ScriptName | Returns the name of the script calling the function—for example, Z-RAMTest |
oUtility.ScriptDir | Returns the path to the script that is calling the function—for example, \\server_name\Deployment$\Scripts |
oUtility.ComputerName | Determines the computer name that will be used during the build process—for example, computer_name |
oUtility.ReadIni(file, section, item) | Allows the specified item to be read from an .ini file |
oUtility.WriteIni(file, section, item, value) | Allows the specified item to be written to an .ini file |
oUtility.Sections(file) | Reads the sections of an .ini file and stores them in an object for reference |
oUtility.SectionContents(file, section) | Reads the contents of the specified .ini file and stores them in an object |
oUtility.RunWithHeartbeat(sCmd) | When the command is run, write heartbeat information to the logs every 0.5 seconds |
oUtility.FindFile (sFilename,sFoundPath) | Searches for the specified file in the DeployRoot folder and standard subfolders, including Servicing, Tools, USMT, Templates, Scripts, and Control |
oUtility.findMappedDrive(sServerUNC) | Checks to see whether a drive is mapped to the specified UNC path and returns the drive letter |
oUtility.ValidateConnection(sServerUNC) | Checks to see whether there is an existing connection to the server specified and, if there is not, attempts to create one |
MapNetworkDrive (sShare, SDomID, sDomPwd) | Maps a drive letter to the UNC path specified as the share and returns the drive letter used; returns an error if unsuccessful |
VerifyPathExists(strPath) | Verifies that the specified path exists |
oEnvironment.Substitute(sVal) | Given a string, expands any variables or functions within that string |
oEnvironment.Item (sName) | Reads or writes a variable to a persistent store |
oEnvironment.Exists (sName) | Tests to see whether the variable exists |
oEnvironment.ListItem (sName) | Reads or writes a variable of type array to a persistent store |
oLogging.ReportFailure (sMessage, iError) | Used to perform a structured exit if an unrecoverable error is detected |
oLogging.CreateEvent (iEventID, iType, sMessage, arrParms) | Writes a message to the log file and posts the event to a defined server |
oLogging.CreateEntry (sLogMsg, iType) | Writes a message to the log file |
TestAndFail(iRc, iError, sMessage) | Exits the script with iError if iRc is false or fail |
TestAndLog(iRc , sMessage) | Logs a warning only if iRc is false or fail |