vCenterInventory

PowerShell Command Line Examples

Simplest format example

C:\TEMP\Collector-vCenterInventory.ps1 "vCenterServer" "C:\TEMP\"

Extensive format example

C:\TEMP\Collector-vCenterInventory.ps1 -vCenter "vCenterServer" -XmlFilePath "C:\TEMP\” -Protocol "http" -Port 80 -Locale "fr" -LogFilePath "C:\TEMP\LOG" -LibraryPath "C:\TEMP\DLL\"

PowerShell Command Line Parameters Described

Parameter Name
.\Collector-vCenterInventory.ps1 / Script name in current folder.
-vCenter / vCenterServer / vCenter server name.
-XmlFilePath / C:\TEMP\ / Fully Qualified Path to storage location of XML file to be created. The application will automatically generate the file name. The file name will be generated by the PowerShell script and take the form “vcenterinventory_MM_DD_YYYY HH.MM.SS.xml”.
-Protocol / http / If included, the script will use the specified protocol to connect to the vCenter web service. If not specified, the default protocol for secure connections ("https") will be used.
-Port / 80 / If included, the script will use the specified port to connect to the vCenter web service. If not specified, the default Port for secure connections (443) will be used.
-Locale / Fr / If included, the script will use the specified language localization when connecting to the vCenter web service. If not specified it will use the default value "en".
-Credential / System.Management.Automation.PSCredential / This parameter accepts a PSCredential object that should contain a valid vCenter Server login.
-ProgressDisplay / -ProgressDisplay / If specified, the command window includes a progress activity indicator.
-SuppressLogFile / -SuppressLogFile / Log files are created by default, if this switch is included the creation of a Log file will be suppressed.
-LogFilePath / C:\TEMP\ / Fully Qualified Path to storage location of Log file to be created. If no path is specified, the file will be created in the same folder as the XML file. The application will automatically generate the file name. The file name will be generated by the PowerShell script and either be “vcenterinventory _MM_DD_YYYY HH.MM.SS.log”.
-LibraryPath / C:\TEMP\DLL\ / Fully qualified path to location of Inviso.SystemDiscovery.Discovery.vSphereServiceClient.dll support library. If not specified, it will default to the same location as this script.
-xDTCall / This value is reserved for internal processing and should be omitted unless instructed otherwise.
-DataSource / This value is reserved for internal processing and should be omitted unless instructed otherwise.
-AppVersion / This value is reserved for internal processing and should be omitted unless instructed otherwise.
Get-Help .\Collector-vCenterInventory.ps1 / For additional command line help use the PowerShell Get-Help cmdlet.

Prerequisite

This script uses the Inviso.SystemDiscovery.Discovery.vSphereServiceClient.dll supportlibrary to communicate with the vCenter web service. This library file can be downloaded from This file should be unzipped and placed in the same folder as this script or itsfully qualified location must be specified using the -LibraryPath parameter when executing this script.

This script requires PowerShell version 3 or greater. To downloadPowerShell 3 or greater go to the Microsoft Download site ( and searchfor "PowerShell".

Script Requirements

The first two parameters are required. All other parameters are optional. If the required parameters are not provided on the PowerShell command line when the script is run the user will be prompted to provide them. If the parameters are entered in the order displayed in the example the “Parameter Name” label may be omitted. If they will be entered in a different order or if only specific parameters are included the “Parameter Name” must accompany the supplied value (ex. –XmlFilePath “C:\TEMP\”). The script will prompt for the credentials (UserName/Password) that will be used to access the vCenter server. Be sure the credentials have the needed permission to access the server specified.

Also, it may be necessary to enable PowerShell script execution. If you receive a warning when executing the script indicating, you do not have permission to run the script on this machine you can try changing the script execution policy. To change the execution policy, from the PowerShell command prompt type the following command then press Enter

Set-ExecutionPolicy Unrestricted -Scope CurrentUser

Description

When the script is run a connection will be made to the vCenter server to retrieve the necessary data. If the Credential parameter was omitted the system will request the user enter them before proceeding. The credentials suppliedmust have the necessary permission to access the vCenter server. Once the credentials have been accepted the script will begin collecting the data and creating the XML export file. If the “ProgressDisplay” parameter was specified the current progress of activity will be displayed at the top of the PowerShell Command window as the data is collected and written. If the “ProgressDisplay” parameter is not supplied, then no information will be displayed until the script has completed. Regardless of the “ProgressDisplay” setting, when the script completes it will display anexecution completion status consisting of three values.

CollectionSuccess: True is successful else False

FileName: The fully qualified name of the file created. If the CollectionSuccess is False, this value will be omitted.

Error: Display of error discovered during execution. If the CollectionSuccess is False, this should contain a description of the issues encountered that did not permit the script to complete successfully.

Author Information

Author: Inviso Corporation

Website: InvisoCorp.com/SAM

Support Email: