Scripting Your Way with Splunk for VMware
As you are going through the install guide, you’ll come to a step where you are required to assign a list of twelve privileges to a user account by using the vSphere Client. In order to save time and to reduce the risk of errors due to manual entry, I wrote a script that does the work for you. This script is especially useful if you have multiple vCenter servers and will need to apply the permission across several datacenters.
The script was tested against vSphere 5 with vCenter Server. This script will not work against an ESXi environment without vCenter, due to the read-only scripting API limit that VMware enforces in that case. In order to use the script (which runs on Windows only), you’ll need a copy of PowerShell (version 2 or later), and PowerCLI (any version, tested with v5.0.1).
The built-in help for the script is comprehensive, but just to be clear:
- Create an account in Active Directory prior to running the script
- Specify the AD account in the format “domain\userID”. SPN format will not work.
- A VI role will be created. If you want to specify a role name, you can do so, otherwise, the default of “Splunker” will be used.
You can download the script from here: https://gist.github.com/3033791
If you have any feedback on the script, please let us know in the comments.