That… Could Be A Problem…

5Apr/161

EUC Day 2016: PowerCLI for View

The Minneapolis VMUG had a terrific idea to put together a specialized event based around End User Computing (EUC) and I was lucky enough to be asked to come and present something around automation.

That brings me to the session I chose, which is an introduction to PowerCLI for View. Horizon View and automation (Powershell, specifically) aren't something that go together all that well at this point in time. PowerCLI for View is a great utility, don't think I'm taking anything away from it nor bashing it, but it does take some understanding to kinda set the groundwork before you dive-in head first. This session is my attempt to help set that groundwork.

Thanks again to Matt Heldstab and the rest of the MN VMUG team for having me out, the event was awesome. I also want to call out the rest of the sessions from that day, which can be found on YouTube: https://www.youtube.com/channel/UCMHCjDBAx2NhBlTRi2ud90A/videos?shelf_id=0&view=0&sort=dd

26Feb/160

PoSh – vCenter License Handling

It's that time of year again for vExperts... Time to replace the NFR licenses the vExpert program has graciously supplied us.

Was given a gentle reminder of this the other day while preparing for a vBrownbag presentation:
Expiring Licenses

I've been on a big Powershell module making binge lately and noticed there really isn't much for handling vCenter's licensing, so I created one and published it out on Github.

An overview of what's currently included in the module:

Function Name Description
Get-VILicenses Gathers information on all VI licenses availabe in the vCenter Server
Get-VILicenses
Get-VILicenseInfo Gathers information on the supplied license key
Get-VILicenseInfo
Add-VILicense Adds the supplied license key to the vCenter Server license inventory
Add-VILicense
Remove-VILicense Removes the supplied license key from the vCenter Server license inventory
Remove-VILicense
Set-VILicense Sets the supplied license key to the desired VI Object
Set-VILicense
Get-VILicense Gathers information on the supplied license key from the VIObject
Get-VILicense

A general walk-through of what's occurring within each function is Powershell interfacing with the License Manager object via VMware's SDK.

Requirements:
PowerCLI modules and/or PSSnapins
Active connection to a vCenter Server

An automated way of downloading the files into a dedicated directory and importing the module into the current session:

Note: this was a script that worked in my environment. There is no warranty or support with this script, please use at your own risk.

11Dec/150

Commitmas: Learning Git Revert

Commitmas time has come again!

For those of you that aren't aware, Commitmas is a program which started last year (2014) with a goal of pushing people to learn how to use GitHub by way of 12 days of different challenges. This year has been expanded out to include the entire month for a full 30 days worth of challenges.

Last year I followed along and tried to push myself to learn how to better use GitHub as I was a very basic user. This year I'm making attempts to be much more involved and even picked up a challenge to present on. The challenge I selected was titled "Wait, I screwed something up and need to roll it back!" and is located at the following link: Commitmas 2015 - Challenge 10

The following session was recorded on December 10th and outlines the challenge and ways to complete it:

Additional Commitmas information and the rest of the challenges can be found on GitHub: https://github.com/commitmas/30-days-of-commitmas-2015

17Nov/151

Nutanix CE Now Available on Ravello!

Two companies that have been doing some pretty cool things on their own have now joined up to offer something very awesome. As of November 17th, Ravello will now be offering a preconfigured Nutanix Blueprint for use with their HVX nested hypervisor offering.

Things to know:

  • The blueprint being offered is the Community Edition (CE) and has all the existing limitations therein. More information can be found on: Nutanix's site
  • A Nutanix NEXT account will be required to use the appliance on Ravello. Sign up is quick and easy, my account took under 5 minutes to create and gain CE access. You can create a NEXT account on: Nutanix's site
  • A Nutanix NEXT account requires a "business email", ie. non-gmail/live/hotmail/etc
  • The appliance asks for 4 CPUs and 16GB RAM. In my account, it was estimated at roughly $1.13/hour to run out of Amazon's cloud.
  • If you happen to be a vExpert with a Ravello account, you may have noticed there's an 8GB/VM limit. With this release, that limit has been bumped to 16GB... on all VMs!

You may be asking "why is this a big deal?" at this point. Nutanix has offered their CE offering for a fair amount of time and the minimum requirements are pretty relaxed, right? While both are true, it's never been this simple. You don't need any hardware at all, just a Ravello & Nutanix NEXT account and 15 to 20 minutes and you have an operational single node cluster available whenever you need it for whatever reason you need it.

Let's walk through getting started:
First, log in to your Ravello account and select the Ravello Repo in the top right-hand corner. There will then be a new window where searching for "Nutanix" will bring up the "Nutanix Community Edition" Blueprint which can be added to your Library by simply clicking "Add to Library".
Ravello Repo

Once complete, head to the "Applications" area and select "Create Application".
Give the new application a meaningful name, check mark the "From Blueprint" option, select the "Nutanix CE..." Blueprint, and select "Create".
Create Nutanix Application

When the application creation completes, you'll be brought to the "Canvas" page for that application. Let's take a second to review the specs on the newly created VM:
Nutanix VM Specs

When reviewing the VM is complete, as I wouldn't recommend changing anything at this point, click on the publish button to push the system out to the desired cloud and get it started.
Note: it's configured to auto-start, so don't walk away. It doesn't take long at all to deploy and it just unnecessarily uses resources as you're paying for it's use or, as a vExpert only given a specific allotment.
Publish Nutanix Application

Once it's deployed, how do you get to it? Click on the Nutanix VM again and off to the bottom right-hand side you'll notice the status for the VM. Within that box, look in the "External access for" box for the NIC which lists in the "Ports" area "9440 (https)". The DNS name and IP is where the PRISM management interface can be loaded. Example:
VM Status Information
Nutanix PRISM Interface

An item to note if you're new to Ravello, the IPs persistent only while that Application is running. Once the Application is shutdown, the IPs are recycled quite quickly. However, the DNS names are persistent and are easily copied out of the VM Status area. I used the IP in these screenshots for simplicity and to hide the public name of my instance.

Logging in is simple, username and password are both "admin". It will prompt for the user to then change the password. Once that's complete, it will ask you to login via the user's NEXT credentials. Once authenticated through, you're all done! Here's a peek at what it looked like for me:
Nutanix Web Console

Definitely want to say thanks to both Ravello and Nutanix for making this happen, and also another thanks for offering a special briefing and early access to the vExperts!

Tagged as: , 1 Comment
9Nov/150

PowerCLI – Quick Stats Not Up To Date Error

Recently rebooted one of my vCenters and came across an error on my ESXi hosts stating "Quick stats on *vmhost* is not up-to-date". A couple seconds worth of googling brought me to VMware KB2061008 which helped to resolve the issue.
Quick Stats Error Message

However, the KB only went through the GUI process of adding in the requisite parameters but there's no fun in clicking through the GUI so I came up with a short script that's applicable to vCenter 6.0 which can also accomplish performing the parameter creation/updates for the KB's workaround.

Once you run the script, you'll still need to restart the vCenter service on your VCSA or Windows server. If you happen to be in the web client:
Go to "Administration" then to the "Deployment" area to select "System Configuration"
Select "Services", then select "VMware vCenter Server"
Select "Actions" followed by "Restart"

Once the service is back up and running the error will no longer be present.
vCenter Service Restart

Note: this was a script that worked in my environment. There is no warranty or support with this script, please use at your own risk.

2Nov/150

PoSh – NSX Module Update

A new update has been published to the NSX Module which I previously published on GitHub: https://github.com/kmruddy/Powershell/tree/master/Modules/NSXModule

A reference to the first blog post I made concerning the module, including some screenshots of it actually in use: http://thatcouldbeaproblem.com/?p=823

The module has now grown to 31 of the following cmdlets:

Cmdlet Description
Get-NSXController Gathers NSX Controller details from NSX Manager
Get-NSXControllerUpgrade Gathers NSX Controller Upgrade details from NSX Manager
Get-NSXEdge Gathers NSX Edge Node details from NSX Manager
Get-NSXEdgeDefaultRoute Gathers NSX Edge Node default route details from NSX Manager
Get-NSXEdgeFeatures Gathers NSX Edge Feature details from all nodes within NSX Manager
Get-NSXEdgeFirewall Gathers NSX Edge Node firewall details from NSX Manager
Get-NSXEdgeInterfaces Gathers NSX Edge Node's Interface details from NSX Manager
Get-NSXEdgeNATs Gathers NSX Edge Node NAT details from NSX Manager
Get-NSXEdgeRoutingOverview Gathers NSX Edge Routing Overview details from all nodes within NSX Manager
Get-NSXEdges Gathers NSX Edge Node details from NSX Manager
Get-NSXEdgeStaticRoute Gathers NSX Edge Node static route details from NSX Manager
Get-NSXEdgeUplinks Gathers NSX Edge Uplink details from all nodes within NSX Manager
Get-NSXIPPools Gathers NSX IP Pool details from NSX Manager
Get-NSXIPSets Gathers NSX IP Set details from NSX Manager
Get-NSXLogicalSwitches Gathers NSX Logical Switches and their details from NSX Manager
Get-NSXManager Gathers NSX Manager details
Get-NSXManagerComponents Gathers NSX Manager component details
Get-NSXManagerSSH Gathers NSX Manager SSH component details
Get-NSXScopes Gathers NSX Scopes and their details from NSX Manager
Get-NSXSSOConfig Gathers NSX SSO details from NSX Manager
New-NSXIPPool Creates an NSX IP Pool within NSX Manager
New-NSXIPSet Creates a new NSX IP Set within NSX Manager
New-NSXLogicalSwitch Gathers NSX Logical Switches and their details from NSX Manager
Remove-NSXEdge Deletes an NSX Edge Node from NSX Manager
Remove-NSXIPPool Removes an NSX IP Pool within NSX Manager
Remove-NSXIPSet Removes an NSX IP Set within NSX Manager
Remove-NSXLogicalSwitch Gathers NSX Logical Switches and their details from NSX Manager
Remove-NSXSSOConfig Removes NSX SSO config from NSX Manager
Restart-NSXManager Configures the NSX Manager for reboot
Set-NSXManagerSSH Configures NSX Manager SSH component
Update-NSXEdge Updates the NSX Edge via Update parameter

If you need an automated way of downloading the files into a dedicated directory and importing the module into the current session please see the following:

Note: this was a script that worked in my environment. There is no warranty or support with this script, please use at your own risk.

29Oct/150

PoSh – Finally Testing PernixData!

My home lab has been in need of some upgrades lately. One of the easiest, and cheapest, was the addition of PernixData and their FVP Freedom edition release.

Couple of caveats I feel I should cover if you've never been exposed to PernixData's FVP product:

  • FVP, the normal offering, cannot activate a Freedom license.
  • FVP Freedom edition cannot be installed and used in trial mode.
  • FVP Freedom edition can only use RAM as an acceleration resource and requires a minimum of 4GB free per host.
  • FVP Freedom edition can only be used for read only acceleration (ie. write through mode).
  • FVP Freedom edition cannot be used with more than one cluster.

With that said, I ended up going with the regular FVP edition in trial mode because I don't have an additional 4GB of RAM available. The install was extremely easy using SQL Express. vSphere Web client plugin installed to my VCSA instance properly and creating the first FVP Cluster was equally as easy. However this isn't about the install and config, so let's jump to the Powershell module!

First, if you're on the management server, import the module:
Import-Module PrnxCli

If you don't happen to be on the management server, you'll want to copy/paste the "Program Files\PernixData\FVP Management Server\Client\PSModule" directory over to the desired system and then point the import cmdlet at the "PrnxCli.dll" file. Pointing the import cmdlet at the "PrnxCli.psd1" file produces an error stating it can't find the nested modules:
import-module prnxcli.dll

Second, connect to the PernixData Management server:
($creds variable is the result of the Get-Credential function used to store credentials)
connect-prnxserver

Since I already setup an FVP cluster, lets explore an existing FVP cluster by the name of "Home". The "Get-PrnxFVPClusterDetail" cmdlet shows all of the objects within the Home FVP cluster:
get-PrnxFVPClusterDetail

Displaying the current acceleration policy for a specific object via "Get-PrnxAccelerationPolicy" for the "probcosplx" VM:
Get-PrnxAccelerationPolicy

Some other cmdlets that can be used to explore the environment include: "Get-PrnxNFS", "Get-PrnxScsiLUN", "Get-PrnxVM", and "Get-PrnxVMFS". However if you're in a smaller environment, you can get a sum of all of those cmdlets by running the "Get-PrnxObject" cmdlet. It's also worth noting that all of the cmdlet responses have quite a bit more information under the covers such as auth level, support status, stats, policies, etc. Run the cmdlet with a " | select *" to see the rest of the information being returned.
Get-PrnxObject

The last thing that we haven't looked at in the exploratory phase would be statistics! Those are pulled by way of the "Get-PrnxObjectStats" cmdlet:
Get-PrnxObjectStats

Now that we have the exploration piece done, let's modify an object to change their Acceleration Policy. This is accomplished by way of the "Set-PrnxAccelerationPolicy" cmdlet:
Set-PrnxAccelerationPolicy

Overall, it's a pretty comprehensive module where anything you can do in the GUI can be done via Powershell. However there are some things, as minor as they are, that I wouldn't mind seeing added to the module in a future release:

  • Get-PrnxAccelerationPolicy - Show the name of the object information is received about, auto-population of the "Type" parameter, and a better way to decipher if an object is accelerated or not (currently an un-accelerated object shows up with an empty FlashCluster but still shows a policy of "Write Through")
  • Adding some functionality around piping output into new cmdlets.

Lastly, I figure I should show off some of the stats as they really are quite impressive. Here's what FVP did for me in just 3 days in my home lab:
Awesome Pernix Stats

15Sep/151

PowerCLI 6.0 R2 – Announcing vROps Integration!

For those that have been requesting some vCOps and/or vROps integration into PowerCLI, as I have been, we finally have our solution! PowerCLI 6.0 R2 brings that to the table in the form of a new module: VMware.VimAutomation.vROps

The following functions are featured in the module:
Connect-OMServer
Disconnect-OMServer
Get-OMAlert
Get-OMAlertDefinition
Get-OMAlertSubType
Get-OMAlertType
Get-OMRecommendation
Get-OMResource
Get-OMStat
Get-OMStatKey
Set-OMAlert

Here's a couple tips to get started using it:
To begin pulling stats you will need to authenticate to the vROps instance via Connect-OMServer:
Connect-OMServer

After getting connected, and being connected to an associated vCenter, check out the resources via Get-OMResource by piping it a VMHost, VM, or so forth:
get-omresource

As you can see, I pulled the resources for a VMHost. Some of the basic, higher level, information is in there such as Health status and value, whether or not vROps is receiving any data about it, and how far back data has been collecting for the resource.

The following is pulling the same information for the vROps VM in my lab environment:
get-omresource

If you want to go straight to the stats, I don't blame you one bit. However just running the Get-OMStat command is going to fill your PoSh window with every single stat available for that resource at all the time points available. Overwhelming would be putting it lightly, so you'll want to also familiarize yourself with Get-OMStatKey. This function allows you to see what all stats you can actually pull:
get-omstatkey

Couple things I feel the need to point out:

  • Include both the AdapterKind and ResourceKind objects when calling this function, it returns every possible stat key possible without it... All 17,646 of them.
  • Even when including the AdapterKind and ResourceKind, I would highly recommend filtering out what what you're looking for. The HostSystem ResourceKind has 2225 stat keys alone.

Finally, lets select a stat key and pull some detailed stats by way of the Get-OMStat function. In this scenario, I'm pulling CPU Ready Summation values:
Get-OMStat

Some of the other functions included surround alerting.

The Get-OMAlert function pulls all of the vROps alerts:
get-omalert

Since there happens to be some alerts, let's check out two abilities of the Set-OMAlert function. The first option being cancelling of an alert:
set-omalert -Cancel

If you notice in the example, the alert still exists but it's status is changed to "Inactive".

Next up, let's check out the suspend function of the Set-OMAlert function:
Set-OMAlert -SuspendMinutes

Overall, the new module definitely gets my stamp of approval! Thanks to the Automation and PowerCLI team for listening to the users and getting this integrated!

Additional information is available at the following link: https://blogs.vmware.com/PowerCLI/2015/09/powercli-6-0-release-2-is-now-generally-available.html

24Aug/150

PoSh – Gathering VMware NSX Info via API

I've been lucky enough to get a chance to do some work involving VMware's NSX product lately. Having watched a bunch of VMworld sessions, live demos and messed around with it in the VMware Hands on Labs I was fairly comfortable in an existing environment. However I've gotten fairly used to using Powershell to do most of my work and there doesn't appear to be much out there in the way of cmdlets or functions.

Chris Wahl has some really good resources regarding using Powershell to do API calls with NSX to both gather controller information (Creating NSX API Calls with PowerShell - Wahl Network) and create/remove virtual network tiers (Leveraging PowerShell to Deploy Virtual Network Tiers with VMware NSX - Wahl Network).

Thanks to Chris' first post, I've taken what he created and built out a couple additional functions and even dumped them all into module form.

An overview of what's currently included in the module:

Function Name Description
Get-NSXController Will inventory all of your controllers from NSX Manager
Get-NSXController
Get-NSXEdges Will inventory all of your Edge Nodes from NSX Manager
Get-NSXEdges
Get-NSXEdgeFeatures Will inventory all of your Edge Nodes' Features from NSX Manager
Get-NSXEdgeFeatures
Get-NSXEdgeInterfaces Will inventory the selected Edge Node's Interfaces from NSX Manager
Get-NSXEdgeInterfaces
Get-NSXEdgeNats Will inventory all of your Edge Node's NATs from NSX Manager
Get-NSXEdgeNATs
Get-NSXEdgeRoutingOverview Will inventory all of your Edge Nodes' Routing Overview details from NSX Manager
Get-NSXEdgeRoutingOverview
Get-NSXUplinks Will inventory all of your Edge Nodes' Uplinks from NSX Manager
Get-NSXEdgeUplinks

A general walk-through of what's occurring within each function is Powershell using the Invoke-WebRequest cmdlet against the NSX Manager's REST API and formatting what's returned into an easy to consume format that is a similar match to what's returned back by way of the "Networking and Security" plugin.

Requirements:
Powershell 3.0 or better: Invoke-WebRequest first appeared in Powershell version 3.0, so anything less won't work.
NSX Manager Admin credentials: All of the information is being pulled directly from the NSX Manager
Import the module by way of the .psd1 file: while not really a requirement, it certainly helps with the formatting of the output

Example of how the formatting is handled, first with the .psd1 file then with the .psm1 file:
Loading NSX PSD1 vs PSM1

Link to the GitHub repo location: https://github.com/kmruddy/Powershell/tree/master/Modules/NSXModule

An automated way of downloading the files into a dedicated directory and importing the module into the current session:

Note: this was a script that worked in my environment. There is no warranty or support with this script, please use at your own risk.

4Mar/151

vSphere SSO – Removal of Additional Application Users

Have you ever logged into the vSphere Web Client and received a warning like this:
Could not connect to one or more vCenter Server systems

This "Could not connect to one or more vCenter Server systems" error means the web client cannot talk to vCenter server. In this case, the server having the error was decommissioned and no longer exists.

To resolve this issue, head into the "Administration" area of the web client. Follow that by going to the "Single Sign-On" area and select "Users and Groups". From there, hit the "Application Users" tab and take a look at the users. In this case there were a total of three vCenters and their associated Inventory Services:
Application Users

While in the above screen, take note of the last 6 characters of each user.

Prior to removing any of those user account it's time to verify those user accounts against the services still in existence. This information is hidden a bit, so some digging is required.

For the vCenterServer Service account, look for the "solutionUser" section of the following file: C:\ProgramData\VMware\VMware VirtualCenter\vpxd.cfg
DecomvCenter03

For the InventoryService account, again, look for the "solutionUser" section of the following file: C:\Program Files\VMware\Infrastructure\Inventory Service\lib\server\config\dataservice.properties
Inventory Service User Account

Once the user account information has been gathered, head back to the "Application Users" section and remove the accounts that were not able to be verified:
Remove vCenterServer Account
Remove InventoryService Account

Once removed, log out of the vSphere web client and log back in and the error message will no longer be displayed across the top of the screen.

Filed under: VMware 1 Comment