4.0

Table Of Contents
n
Simple string exception type checking must use the following pattern.
try {
throw "VMwareNoSpaceLeftOnDatastore: Datastore 'myDatastore' has no space left" ;
} catch ( e if (typeof(e)=="string" && e.indexOf("VMwareNoSpaceLeftOnDatastore:") == 0) ) {
System.log("No space left on device") ;
// Do something useful here
}
n
Simple string exception type checking, must use the following pattern in scripted elements in workflows.
if (typeof(errorCode)=="string"
&& errorCode.indexOf("VMwareNoSpaceLeftOnDatastore:")
== 0) {
// Do something useful here
}
Orchestrator JavaScript Examples
You can cut, paste, and adapt the Orchestrator JavaScript examples to help you write JavaScripts for common
orchestration tasks.
n
Basic Scripting Examples on page 124
Workflow scripted elements, actions, and policies require basic scripting of common tasks. You can cut,
paste, and adapt these examples into your scripted elements.
n
Email Scripting Examples on page 125
Workflow scripted elements, actions, and policies require scripting of common email-related tasks. You
can cut, paste, and adapt these examples into your scripted elements.
n
File System Scripting Examples on page 126
Workflow scripted elements, actions, and policies require scripting of common file system tasks. You
can cut, paste, and adapt these examples into your scripted elements.
n
LDAP Scripting Examples on page 126
Workflow scripted elements, actions, and policies require scripting of common LDAP tasks. You can cut,
paste, and adapt these examples into your scripted elements.
n
Logging Scripting Examples on page 127
Workflow scripted elements, actions, and policies require scripting of common logging tasks. You can
cut, paste, and adapt these examples into your scripted elements.
n
Networking Scripting Examples on page 127
Workflow scripted elements, actions, and policies require scripting of common networking tasks. You
can cut, paste, and adapt these examples into your scripted elements.
n
vCenter Server Scripting Examples on page 127
Workflow scripted elements, actions, and policies require scripting of common vCenter Server tasks.
You can cut, paste, and adapt these examples into your scripted elements.
n
Workflow Scripting Examples on page 129
Workflow scripted elements, actions, and policies require scripting examples of common workflow tasks.
You can cut, paste, and adapt these examples into your scripted elements.
Chapter 4 Scripting
VMware, Inc. 123