For additional information about Windows PowerShell and signing scripts, see:
n
Scripting with Windows PowerShell:
http://technet.microsoft.com/en-us/scriptcenter/dd742419.aspx
n
Windows PowerShell Owner's Manual:
http://technet.microsoft.com/en-us/library/ee176949.aspx
n
Signing Windows PowerShell Scripts:
http://technet.microsoft.com/en-
us/magazine/2008.04.powershell.aspx
n
Execution Policies:
http://technet.microsoft.com/en-us/library/dd347641.aspx
n
Registry value that controls execution policy:
http://msdn.microsoft.com/en-
us/library/bb648598(VS.85).aspx
Developing Custom Collection Scripts
Development of custom collection scripts requires planning the data structure. WCI internally stores data
hierarchically, as displayed in the Tree View - Standard node. The collection script is required to provide all
of the structure that can be seen in any branch under this node.
The root element in the XML result data set will become a top level (root) element in the WCI data type
node. Child elements will appear in the same locations in the VCM user interface as the locations they
populate in the XML document that is returned by the script.
When developing custom collection scripts, follow these guidelines:
n
XML element names must be unique at their level (for example, two "Child1" nodes can exist, as long as
they are not siblings).
n
Attributes must be unique at their level.
n
Element and attribute names used must be valid XML when returned by the script. If data is to be
returned as an element or an attribute name that is not valid for XML, the name can be encoded using
the [
ToCMBase64String
] function. The inserter will recognize names encoded with this function and
will decode them during the raw insert process. The inserter is a Collector job that is executed during
each collection. It is responsible for parsing the Agent results files and putting the data into a new raw
database table. The raw data is then transformed into the data that appears in the nodes in the user
interface.
function ToCMBase64String([string]$input_string)
{
return [string]("cmbase64-" +
[Sys-
tem.Co-
nvert]::ToBase64String([System.Text.Encoding]::UNICODE.GetBytes($input_
string))).replace("=","-")
}
n
If a script has configurable parameters, they should be described in a comment block near the top of
the script, along with configurable entries of the parameters near the top of the script, so that a user
who is cloning a WCI collection filter can easily see and set the parameters in the
Edit Filter
wizard (
in
Administration | Collection Filters | Filters
).
n
Declaration of variables, and any other tasks in a script that produce output that is not part of the XML
result set, should be redirected to out-null, such as:
[reflection.assembly]::LoadWithPartialName("Microsoft.SqlServer.Smo") | out-
null
n
The default WCI filter returns PowerShell version information from VCM-managed machines.
See also the example below of developing a custom PowerShell script for use with the WCI data type.
Getting Started with VCM
VMware, Inc.
77
Summary of Contents for VCENTER CONFIGURATION MANAGER 5.3
Page 8: ...vCenter Configuration Manager Installation and Getting Started Guide 8 VMware Inc...
Page 46: ...vCenter Configuration Manager Installation and Getting Started Guide 46 VMware Inc...
Page 158: ...vCenter Configuration Manager Installation and Getting Started Guide 158 VMware Inc...
Page 178: ...vCenter Configuration Manager Installation and Getting Started Guide 178 VMware Inc...
Page 194: ...vCenter Configuration Manager Installation and Getting Started Guide 194 VMware Inc...
Page 204: ...vCenter Configuration Manager Installation and Getting Started Guide 204 VMware Inc...
Page 208: ...vCenter Configuration Manager Installation and Getting Started Guide 208 VMware Inc...
Page 234: ...vCenter Configuration Manager Installation and Getting Started Guide 234 VMware Inc...
Page 264: ...vCenter Configuration Manager Installation and Getting Started Guide 264 VMware Inc...
Page 274: ...274 VMware Inc vCenter Configuration Manager Installation and Getting Started Guide...