#------------------------------------------------------------------------------
# Copyright (C) 2008-2013 by EMC Corporation 
# All rights reserved.
#------------------------------------------------------------------------------
*******************************************************************************
 This software contains the intellectual property of EMC Corporation or is 
 licensed to EMC Corporation from third parties. This software is protected,
 without limitation, by copyright law and international treaties. Use of this
 software and the intellectual property contained therein is expressly limited
 to the terms and conditions of the License Agreement under which it is 
 provided by or on behalf of EMC.
*******************************************************************************

Release : EMCGrab v1.3.2(For vSphere/ESXi Servers)
Release Date : September 2013
Author  : Global Services Software Development
*******************************************************************************

PERFORMANCE DEGRADATION NOTICE:
On some hosts, where high I/O is a normal course of events, running this
utility may cause some performance degradation when running some commands. 
Best practices should prevail, such as running at off peak hours
*******************************************************************************

IMPORTANT NOTES:

1] The VMware VMsupport log-bundle script may take some time to execute. The
   option to run this script should NOT be used during a production load. 
   Quiesce any databases and minimize system load as much as possible before 
   running. VMsupport output is separate from EMCgrab and will be placed in the
   same directory. EMC and/or VMware Technical Support will advise if both 
   outputs need to be uploaded.

2] If run with the -autoexec switch enabled and the host uses naviseccli then 
   in order to collect CLARiiON information, the security file should have been
   already created using -AddUserSecurity feature of naviseccli. If that file 
   is absent then EMCGrab will not collect any CLARiiON information.

3] The application will prompt the user with a warning message should it detect
   less than 100M remaining on the file system at launch time. If this occurs
   the user will have the option of continuing or aborting the application.

4] The application will prompt for EMC's license agreement even in autoexec 
   mode, unless the '-legal' switch is specified. Once EMC license agreement is
   accepted then it will work as usual for autoexec mode.
   
5] If -legal switch is specified it means that you the user accepts the EMC's
   license agreement.
   
6] If the application does not complete execution normally, e.g. Ctrl C is used
   to kill the application, then some child processes may not be terminated.
   Potential Child processes are:
     Navisphere processes
     PowerPath processes
     Solutions Enabler SYMCLI processes
   Corrective action for this issues is to kill the process manually using the
   Windows Task Manager or restart the machine
   
7] It is the user's responsibility to ensure that the correct Windows version is
   being used if the below tools or any of their sub-components are installed
   as they may be used by this application:
   	Solutions Enabler
   	PowerPath
   	Navisphere
   	
8] For some QLogic HBA cards the BIOS version is returned as 0.0.0. 
   This is a known issue for QLA2342 cards.
   
9] ESXi 5.* does not have third party CIM providers installed by default.  This
   can result in missing HBA information.  The CIM provider modules must be
   obtained from the respective vendors, and manually installed and enabled on
   the ESXi 5 servers.  Emulex HBA CIM information can be obtained at:
   ‘http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=
   displayKC&externalId=2001548’
   QLogic HBA CIM provider information can be obtained at:
   ‘http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=
   displayKC&externalId=2001551’
   
    
*******************************************************************************

This application is provided as a means to collect system and/or software 
configuration for investigations by EMC.

To Install :

Extract the archive file on the client machine into suitable directory.
The client machine must have HTTP access to the ESX virtual centre

Please ensure that your File System has at least 500M free of disk space for 
temporary files that may be generated during its processing.

Operation :
It is possible that some commands could run for a lengthy period. Each module
has a max runtime limit, ranging from 60 seconds through to 450, depending
on the module.

The script will generate a compressed zip file, residing in the outputs
directory.  Its format will be

<hostname>_YYYY-mm-dd-hh.mm.ss>_ESXi_emcgrab_<version>_full_CC<CaseNumber>.zip

If no Request number is defined, <CaseNumber> will default to 0000000000

*******************************************************************************

Command line Syntax :

./emcgrab.exe [-h] [-v] [-host <host>] [-vsphereUrl <URL>]
              -user <user> -password <password>
              [-vmsupport]
              [-autoexec] [-legal] [-quiet]
              [-case <service request number>] [-party <party number, site id>]
              [-customer <company name>] [-contact <contact name>] 
              [-email <contact email>] [-phone <contact phone number]
              [-clariionip <IP Addresses> ] [-outdir <new_output_directory>] 
              [-noclariion]
              [-symApiServer <SYM API server>]

where
    -h              : Displays help screen and exit.
    -v              : Displays version information and exit.
    -host           : The IPv4 Address of the ESXi host
    -vsphereurl     : The vSphere URL used in discovery if not specified then 
                    : ?host is used to construct the default value:
                    :   https://<IPv4 Address from -host>/sdk
                    : Example https://10.211.87.15/sdk
                    : This or host must be specified for a grab to be created
    -user           : ESXi host login user name
    -password       : ESXi host login password (cannot contain "<>&' chars)
    -passwordPrompt : Displays prompt to enter password.  Cannot be used with
                    : -password switch.  Only use if encountering password issues.
    -vmsupport      : Include vSphere Log Bundle in the grab output.
    -outDir         : Target folder for Grab output files.
                    : Enclose in quotes if contains a space.
    -quiet          : Suppresses all feedback.
    -legal          : Bypass the showing of Legal Notice and asking the user to 
                    : accept it.
                    :  [If this switch is specified it means user auto accepts
                    :   the EMC's license agreement]
    -autoexec       : Bypasses all interactive prompts except the license 
                    : acceptance, use -legal to ensure not prompted for this        
    -case           : Sets service request number in customer.profile
                    : This has to be a numeric, integer.
                    : Max Length is 10 digits
                    : Default is 0000000000
                    : If the value entered is invalid then an error is logged
                    : and shown to user console and the default value is used
    -party          : Sets Party Number of Customer (site-id) in customer.profile
    -customer       : Sets Company Name in customer.profile
    -contact        : Sets Customer Contact Name in customer.profile
    -email          : Sets Customer Contact Email Address in customer.profile
    -phone          : Sets Customer Contact Phone Number in customer.profile
    -clariionip     : Comma separated list of IP addresses for SPA / SPB
    -noclariion     : Do not gather CLARiiON information
    -symApiServer   : Execute SYMCLI calls.  Default value = "SYMAPI_SERVER". 
                    : Optionally specify another service to use.  The value must
                    : match that which is configured in the SMYAPI config file.
                    : The netcnfg file is usually found in the folder
                    : Windows:    "C:\Program Files\EMC\SYMAPI\config\"
                    : Linux:      "/opt/emc/SYMCLI/config/"


*******************************************************************************

OS Support :
This version of ESX EMCGrab is tested and supported on the following 
Operating Systems

      : ESXi 4.*, 5.*

During normal operation, it is possible that some commands will report 
"Not Found", as the command file contains all commands for each OS and 
application release.  This is normal.

Module Support :

VMWare vSphere:
Data retrieved from the VMware vSphere API is done by connecting to the ESXi
Host.
Data retrieved via this module is store in the GRAB folder "host"


CIM Web Service:
Data retrieved from the CIM API is done by connecting to the ESXi Host.
Data retrieved via this module is store in the GRAB folder "host"


PowerPath :
In order for PowerPath Files to added to the GRAB, rpowermt 5.4 or greater
needs to be installed and available on the users path.
Note: Ensure you have a valid lock box with a pass phrase created before
      running a grab, see PowerPath documentation for further details.
      Failure to do this may result in the rpowermt call preventing the Grab to
      complete it's execution. If this occurs the corrective action is to stop
      the rpowermt process via the Windows Task Manager.
This module makes rpowermt calls to ESX Host, if it detects the rpowermt 
executable.  All results from these calls will be placed in the grab subfolder
called "pp" with the name based on the following naming convention,
rpowermt_<lowercase command with spaces or = chars replaced by an 
underscore>.txt


Navisphere Command Line Interface (NaviCli and NaviSECCli):
In order for Navisphere Files to added to the GRAB, Navisphere 6.2 or greater
needs to be installed.
This module makes Navisphere CLI calls to Clarrion SP?s IP Addresses retrieved
from ESX Host via vSphere or CIM Modules, IP Address can also be specified with
a command line switch.
If it detects the NaviCLI it will use this before NaviSECCli to execute the 
commands.  All out results from these calls will be placed in the grab 
subfolder called "CLARiiON/<ip address>" with the name based on the following
naming convention,
<executable used, navicli or naviseccli>_<lowercase command with spaces and = 
chars replaced by an underscore>.txt


Solutions Enabler SYMCLI:
In order for Solutions Enabler Files to added to the GRAB, Solutions Enabler 6 
or greater needs to be installed.
This module makes SYMCLI calls to the remote SYMAPI Server configured on the
client.
All results from these calls will be placed in the grab subfolder 
called "se" with the name based on the following naming convention,
<lowercase command with spaces replaced by an underscore>.txt

*******************************************************************************

Sending the report file to EMC:

Once you have created your report file you need to send it to EMC Customer 
Service for analysis. This is done easily and securely using EMC WebSupport.

Go to WebSupport Case Management (Note: You must be a registered WebSupport
user.  Select the registration link to register) 

For a new support case select 'Create a Case' and complete the simple
step-by-step creation process. Once you submit your case you will have the
opportunity to upload your EMC Grab file to your case using the 'Attachments'
functionality. 

For an existing Support case, locate your case by using the 'Quick Case Search'
or 'My Open Cases' portlets or by using the 'Case Query' functionality in
'Case Management.' Select the 'Attachments' tab and upload your file.

Note: You may also use EMC's ftp site if WebSupport is not available.
Contact EMC Customer Service for more information.

*******************************************************************************************
EMCGrab v1.3.2 changes
1. Support for HP Insight Manager WBEM Fibre Channel Host Bus Adapter Provider on ESXi 5.*.
2. Fixed issue with vm-support retrieval
3. Caracters ^ and | are not supported in password field. Wrap password in quotes or use the -passwordPrompt switch if required.

EMCGrab v1.3.1 changes
1.  Support for Emulex and Qlogic HBAs on ESXi 5.*.

EMCGrab v1.3.0 changes

1.  Add quiet mode.
2.  Compatibility with ESXi5.0
3.  Addition of 'VMware_SoftwareIdentity.txt' to obtain HBA driver information from ESXi5.*
4.  Addition of BROCADE data collection.  Files:
    - 'BROCADE_Product.txt'
    - 'BROCADE_StorageExtent.txt'
    - 'BROCADE_FCPort.txt'
    - 'BROCADE_FCPortStatistics.txt'
    - 'BROCADE_AdapterSoftwareIdentity.txt'
    - 'BROCADE_PhysicalPackage.txt'
5.  Bugfix in 'NetworkInfo.txt' to collect all available information
6.  Ensure 24hr timestamp on output
7.  Compatible with SymCLI 7.*
8.  Set -symApiServer default value to "SYMAPI_SERVER".  Option remains to specify another service.
9.  Added optional -passwordPrompt switch to display input dialog to fix issues with CP1252 encoding.
10. Fixed issue with characters "&<>' in ESXi login password.  These characters can now be used.
11. Improved ESXi version not supported error message to include name and version of OS.

EMCGrab v1.2.1 changes

1. Compatible with NaviSECCLI v7.*
2. Compatible with PowerPath v5.5, 5.6, 5.7

EMCGrab v1.2.0 changes

1. It is now OK to use either the hostname or the IP Address 
   with the -host switch
 
2. Added code to prompt user when they attempt to use the following characters
 as part of the password "<>&'
 
 	a. Using any of these characters in the password is NOT allowed.
 	If any of these characters is used in the password, each of these characters
	may result in a different outcome. Please see the table below for outcomes
	when using one of the restricted characters.	
 
  
------------------------------------------------------------------------------------------
Error When Running Command                                 | Possible Problem
------------------------------------------------------------------------------------------
														   | 
														   | Special characters in 
Invalid login											   | password can cause issues. 
														   | 
														   | A possible workaround 
														   | is to wrap a password in 
														   | quotation
														   | marks e.g. "pa^sw&rd"
------------------------------------------------------------------------------------------							
                                                           |
Invalid login                                              | Used a " in the password
Could not open a connection to the ESXi host               | Example: -password Pass"word
                                                           |
Complete Fail. Unable to run grab.                         | Double quote is NOT allowed
                                                           | as part of the password
------------------------------------------------------------------------------------------
                                                           |
Invalid login                                              | Used a & in the password
Could not open a connection to the ESXi host               | Example: -password Pass&word
                                                           |
Complete Fail. Unable to run grab.                         | Ampersand character is NOT
'1' is not recognized as an internal or external command,  | allowed in password
operable program or batch file.                            |
                                                           |
------------------------------------------------------------------------------------------
                                                           | Used a > in the password
Commands hangs indefinitely                                | Example: -password Pass>word
                                                           |
                                                           | Greater Than character is NOT 
                                                           | allowed in password
------------------------------------------------------------------------------------------
                                                           |
DO YOU AGREE TO ACCEPT THE TERMS & CONDITIONS OF THIS      | Used a < in the password
LEGAL AGREEMENT (Y/N): THANK YOU FOR USING EMCGrab.        | Example: -password Pass<word
UNFORTUNATELY, YOU CAN'T RUN EMCGrab UNTIL YOU ACCEPT      | 
 THE TERMS & CONDITIONS OF THIS LEGAL AGREEMENT.           | Less Than character is NOT                           
                                                           | allowed in password
------------------------------------------------------------------------------------------                                                           
                                                           | Used a ' in the password
-password containing any of the following 5                | Example: -password Pass'word
characters are not supported "&<>'                         |
                                                           | Single Quote character is NOT
                                                           | allowed in password
------------------------------------------------------------------------------------------
*******************************************************************************************