How to see which session has the Remote Console opened in VMware! (GUI and PowerCLI!)

So you ever been in that situation where you either see a message like,

Number of active connections has changed. There are now 2 active connections to this console

Or…

Unable to connect to the MKS: Console access to the virtual machine cannot be granted since the connection limit of ‘x’ has been reached.”  (This second one is most likely to come up when you have either a STIG or security defined limitation to the number of remote connections to use, thus by default you’re more likely to see message #1!)

Well, the question is… What do you do in these circumstances? You might ask yourself, “Damnit! Who is the other person connected!”   When looking for this answer you may come across responses in the forums such as:

  • Just use tsadmin to login to the server to see who else is logged in
    • Great if you’re on windows, but that doesn’t tell you show OWNS the SESSION
  • ssh into the box to see who else is logged in
    • Wow it’s like you’re not getting it. What if they’re not logged in, but simply sitting at the login prompt? I hear fail…
  • Use arbitrary application to arbitrarily see who is logged in!
    • Okay, seriously? (Yes I’ve seen NUMEROUS responses like this, which refer to lots of applications, and don’t solve the problem…)

Well, guess what, I don’t like these answers, which prompted me to write this blog post, thus I’ll show you how to do it via the GUI (Very Easy…) and also via PowerCLI because we love PowerCLI! Disclaimer: I do not show how to do this using the VMware Web Client, because I personally hate the web client, so if you’d like to document that part, go for it. :)

Checking for Remote console connected in the GUI!

image

So within the handy GUI from within a Virtual Machine (In this context I use the UI VM for vCOPS…) Just click on the “Tasks & Events” tab and you’ll notice the entry below, “Remote console connected” looking at the timestamp you’ll be able to note which user it was which connected and at what time.  Thus if this user doesn’t need to be logged into the console you can go kill their session as needed. Easy Peasy, right?! :)

Checking for Remote console connected using PowerCLI!!!

This one is just as easy if not easier, especially if you want to modify this script ultimately to query lots of objects, or you can even modify it to see which particular sessions a particular user has opened, that is outside the scope of THIS blog post, but nonetheless, here is the syntax!

Get-VM %VMNAME% | Get-VIEvent | Where {$_.Gettype().Name -eq "VMRemoteConsoleConnectedEvent"} | Select UserName, CreatedTime, FullFormattedMessage

What you have here is a Get-VM looking at a specific Virtual Machine (You supply) then it will pull up from that VM or VMs the Remote Console Connected event, After which point PowerCLI will dump the results of the Username connected, what time they did, and the FullFormattedMessage (Which I mainly have in there for errorchecking, you can omit if you’d like)

But lo and behold, BOOM you’re done! Hopefully this was easy for you, if you’d like there are a lot of VERY long and VERY complex scripts which do the EXACT same thing, but you know how I feel about One-Liners. :)

Good luck and stay Physical, VIRTUAL I MEAN VIRTUAL, OMG!

OMG It’s Finally here! Infinio Accelerator for NFS by @InfinioSystems goes GA!

Well it is finally here! Are you excited? You ought to be!

Who or what IS Infinio?!?

So I know what you’re thinking, WHAT exactly is this?!  I first came to know Infinio earlier this year when I saw just how awesome this solution is.  Imagine a solution using server-side caching to minimize and off-load I/O requests so only what is required is sent back to the your shared storage.   It essentially takes 8GB of idle memory on your ESXi hosts and creates a deduplicated cache in memory.   Okay, that’s a lot of jibber-jabber, what exactly does that mean?

If you’re using NFS today you can simply download and deploy the tool in minutes.  And then all of a sudden you’re ready to rock and roll!

1.  Connect to vCenter 2.  Choose Datastore3.  Validate Hosts

4.  Preview Installation

The installation is as easy as this.  And then you’re ready to go with your NFS datastore being accelerated.

I’ve talked with the engineers and creators of this product and I was excited for this when it was in Alpha and Beta.  With it being GA this is infinitely more exciting!  The coolest part is, this isn’t simply a one-off solution which will impact your operations individually.  It scales with more installations!

Your Infinio Cache scales with your installations!

Fortunately unlike most products these days, the dashboard doesn’t look like a disgusting pile of sin.  It’s pretty and provides relevant information!

The Infinio Accelerator Dashboard actually provides relevant information!

Couple of cool things associated with this release!

  • No new hardware. No reboots. No interruptions in service to install or implement.
  • Accelerates all workload types
  • Download on a 30 day trial and license when complete – The true “Try before you Buy”

This can basically turn your NFS into providing Flash-like performance accelerating whatever your backend storage happens to be.   Hey, worst case you can give it a try and see it for yourself!

For more details you can check out the Tech Field Day earlier this year where  Peter Smith Demonstrates Infinio Accelerator

In addition today with the special announcement day there will be a Live Webinar with Q/A today Nov 5 at 3PM EST.

I’ll unfortunately miss this awesome announcement webinar because… well, Afghanistan, timezones and I’ll be asleep at the 1AM or so that it’s at! :)

So check it out, be awesome, and rock rock rock!

How to detect VMFS3 and VMFS3 Upgraded Datastores with PowerCLI; Now with more sugar!

You’re not new to Virtualization, this isn’t your first VMware rodeo, but you find yourself starting to question… OMG DO I HAVE VMFS3 DATASTORES STEATHILY HIDING IN MY SYSTEM?! I mean you do your due diligence, you check and confirm that it says VMFS5 and that it has a 1MB (Universal) block size, but yet… you’re still not sure… Hell, you might even be saying WTF? 1MB BLOCK SIZES? WTFS?!  Well, hopefully this helps break through some of the barriers to not only identify whether you have VMFS3 datastores period, whether they’re actually stealthily hiding!

What’s the big deal with upgrading VMFS3 to VMFS5?

Yea, you read the VMware documentation like this; How VMFS5 Differs from VMFS3 – Basically by reading that you come to the conclusion of ITS EASY, JUST DO IT, YAY!  But to quote Jason Corbett @NGTJason “migrate > upgrade”

Why exactly though? I mean if you read what Cormac Hogan @VMwareStorage wrote so long ago vSphere 5.0 Storage Features Part 1 – VMFS-5 you might be pressured to believe that it’s all good, caveats aside that your VMFS5 upgraded datastores will rock out just like VMFS3, but take a gander at Jason Boche @JasonBoche VMFS-5 VMFS-3, What’s the Deal?

Differences between upgraded and newly created VMFS-5 datastores:

VMFS-5 upgraded from VMFS-3 continues to use the previous file block size which may be larger than the unified 1MB file block size. Copy operations between datastores with different block sizes won’t be able to leverage VAAI.  This is the primary reason I would recommend the creation of new VMFS-5 datastores and migrating virtual machines to new VMFS-5 datastores rather than performing in place upgrades of VMFS-3 datastores.
VMFS-5 upgraded from VMFS-3 continues to use 64KB sub-blocks and not new 8K sub-blocks.
VMFS-5 upgraded from VMFS-3 continues to have a file limit of 30,720 rather than the new file limit of > 100,000 for newly created VMFS-5.
VMFS-5 upgraded from VMFS-3 continues to use MBR (Master Boot Record) partition type; when the VMFS-5 volume is grown above 2TB, it automatically switches from MBR to GPT (GUID Partition Table) without impact to the running VMs.
VMFS-5 upgraded from VMFS-3 will continue to have a partition starting on sector 128; newly created VMFS-5 partitions start at sector 2,048.

I THINK I HAVE VMFS3 VOLUMES HOW DO I TELL, OMG WHAT IS THAT BURNING SENSATION

Hey, calm down, calm down… I think we can solve this problem pretty easily! And if the burning sensation continues, get that checked out!

I don’t know about you, you might have 1 vCenter, 3 Servers and a handful of Datastores. I have thousands… of EACH, so I needed something to do my scans and checks at scale with PowerCLI because I’m a baller, and apparently I pull that off rather well. :)

Methods of detecting whether you have VMFS3, VMFS3 upgraded to VMFS5 or otherwise mismatched sets..

  • Block Size is greater than 1MB
  • Partition type is msdos instead of gpt (*Detected by checking whether the StartSector is 128 instead of 2048)
  • And of course, your VMFS version is VMFS3 or 3.46

But wait, didn’t you say above that partition types will change from MSDOS to GPT if they’re expanded? Doesn’t that make tracking harder? Yes.

Let’s get our PowerCLI on so we can crack this nut!

Get-Datastore | Get-View | Select-Object Name,@{N="VMFS version";E={$_.Info.Vmfs.Version}},@{N="BlocksizeMB";E={$_.Info.Vmfs.BlockSizeMB}}
// To check VMFS version & block sizes – Really useful to just check in general that your version is 5.54 and your blocksize is 1MB though if you VMFS3->5 In-place upgrade when VMFS3 was 1MB, this won’t reveal itself to you

Get-Datastore | Get-View | Where {$_.Info.Vmfs.Version –eq “3.46”} | Where {$_.Info.Vmfs.BlockSizeMB -eq "1"} | Select-Object Name,@{N="VMFS version";E={$_.Info.Vmfs.Version}},@{N="BlocksizeMB";E={$_.Info.Vmfs.BlockSizeMB}}
// To Check VMFS Version and Block Sizes but only listing mismatches you specify  – so if you want to see if you specifically have any 3.46 VMFS and various block sizes

Busting out the mad $esxcli syntax!

This is where we start to get real. The following examples are simple ‘one-liners’ which are cute and all if you’re checking one host, but I also give you one which will scan EVERYTHING so you can just sit back and bask in the glow of figuring out WTF IS GOING ON WITH THIS BURNING, HELP HELP HELP!

$esxcli.storage.core.device.partition.list() | Select Device, StartSector
// Dumps all Offsets – This can be useful if you want to see a lot of data… but less so if you’re looking for something specific…

$esxcli.storage.core.device.partition.list() | group-Object -Property Device | Where {$_.StartSector –eq “128”} | Select Device, StartSector
// Dumps only offsets which "equal" a startsector, in this case 128 – Now we’re cooking with oil, a StartSector of 128 leans on a datastore being VMFS3 or VMFS5 which had been upgraded from VMFS3

$esxcli.storage.core.device.partition.list() | Where {$_.StartSector -eq "128"} | Select Device, StartSector
// This will dump all of your partitions which have a starting offset of 128, same as above but shorter

Script me baby one more time!

OMG YOU JUST MADE A HORRIBLY DATED REFERENCE TO BRITNEY SPEARS. For what its worth, I believe she did some scripting in her days…   The scenarios below will just ‘do it’ based upon whatever hosts you connected to with Connect-VIServer, obviously the difference being ‘comments’ or not.

foreach ($myHost in get-VMHost)
#This tells the system to do a run the command against all "VMHosts" that you have defined as part of your Connect-VIServer
{
    Write-Host ‘$myHost = ‘ $myHost
    #Display the ESXi Host that it is operating against, helps if you’re scanning multiple vCenters
    $esxcli = Get-EsxCli -VMHost $myHost
    #This sets the syntax and the context for the Get-EsxCli command to operate, a requirement for running $esxcli.Commands
    $esxcli.storage.core.device.partition.list() |
    #Use Get-EsxCli to list the core storage devices
    Where {$_.StartSector -eq "128"} |
    #This specifies we’re only looking for partitions which have a StartSector of 128, which could mean either VMFS3 or VMFS3 upgraded to VMFS5 Datastores
    Select Device, StartSector
    #When all is said and done, it’s nice to see it in a ‘pretty’ format to see what work you need to do!
}

Without Comments

foreach ($myHost in get-VMHost)
{
    Write-Host ‘$myHost = ‘ $myHost
    $esxcli = Get-EsxCli -VMHost $myHost
    $esxcli.storage.core.device.partition.list() |
    Where {$_.StartSector -eq "128"} |
    Select Device, StartSector
}

Now technically you could use partedUtil but that’s a pain in the ass.  – But for the sake of continuity here is the syntax/results!

~ # partedUtil getptbl "/vmfs/devices/disks/naa.60a98000646e4f4b475a6a4975422d66"
msdos
261083 255 63 4194304000
1 128 4194298394 251 0
~ # partedUtil getptbl "/vmfs/devices/disks/naa.60a98000646e4f4b475a70516f34416f"
gpt
534698 255 63 8589934592
1 2048 8589934558 AA31E02A400F11DB9590000C2911D1B8 vmfs 0
~ #

So in case you’re wondering if the script is working properly you should end up with results similar to this below;

Results:
$myHost =  103.domain.local

Device                                                      StartSector
——                                                      ———–
naa.60a98000323764703424434e6246775a                        128
$myHost =  102.domain.local
naa.60a98000323764703424434e6246775a                        128
$myHost =  101.domain.local
naa.60a98000323764703424434e6246775a                        128
$myHost =  037.domain.local

And that is basically all it takes! This hopefully should give you the fuel you need to scan your environment with minimal effort and identify any VMFS3 datastores so you can clean that stuff up and MIGRATE!  I discovered a bunch of them which aren’t so kind, and what ensues is massive migrations!

Good luck out there! and if you can find some good way to hack esxcli to ALSO have it then correlate that data to what the datastore name is… I FAILED :)

PowerCLI One-Liners to make your VMware environment rock out!

So I hadn’t touched PowerCLI in a long while (Hey, I hadn’t touched the CONSOLE OF ANYTHING near production after having been in management for so long!   So, the first thing I decided to do was, “Well, what data is important to me… and what will make my life easier!”   Below you’ll see examples of some of those very scenarios, One-Liners and collections of data points! If you haven’t worked with PowerCLI this is a good way to get started.  I’ll also explain WTF I did and why, so you have some good logic and reasoning behind why to use some of these measures!  Also if you happen to have any really cool one-liners and scripts you’ve used, feel free to toss them into the comments!

Let’s start with … Well, getting started!

Launch PowerCLI CMDLine as an elevated user (This is especially important if you have a different administrative acct than your login)

Connect-VIServer

// You can paste in all of the vCenter Names in order to execute a ‘command’ against all of them.

Example, You can simply launch Connect-VIServer, hit enter and then paste a list of vCenters to connect to.  This is especially important if you happen to be managing more than one vCenter.

Get-VMHost | Get-VMHostNetwork | Select Hostname, VMKernelGateway -ExpandProperty VirtualNic | Where {$_.ManagementTrafficEnabled} | Select Hostname, PortGroupName, IP, SubnetMask

// This will then dump the ESXi Hostnames, IPs and Subnets – For the Management Network

Get-VMHost | Get-VMHostNetwork | Select Hostname, VMKernelGateway -ExpandProperty VirtualNic | Where {$_.vMotionEnabled} | Select Hostname, PortGroupName, IP, SubnetMask

// This will then dump the ESXi Hostnames, IPs and Subnets – For the vMotion Network

Get-VMHost | Get-Cluster | Select Name, DrsEnabled, DrsMode, DrsAutomationLevel

// Dump DRS Status

Get-VMHost | Get-Cluster | Select Name, VMSwapfilePolicy

// Dump VMSwapfilePolilcy

Get-VMHost | Get-Cluster | Select Name, HAAdmissionControlEnabled

// Check status of HA Admission Control

Get-VMHost | Get-Cluster | Select Name, HAFailoverLevel, HARestartPriority, HAIsolationResponse

// Check HA Status Levels

Get-VMHost | Get-VMHostNetwork | Select Hostname, VMKernelGateway -ExpandProperty VirtualNic | Select Hostname, PortGroupName, IP, MTU

// Check for MTU Mismatches

Get-VirtualSwitch | Select VMHost, Name, MTU

// Shows what the MTU settings on the Virtual Switches are

Get-VMGuestNetworkInterface –VM VMNAME | Select VM, IP, SubnetMask, DefaultGateway, Dns

// Dumps a hosts Name, IP, Subnet, Gateway and DNS configuration

Append ‘| Export-Csv “c:\location\filename”’

// This will allow you to export the results to a CSV file  – This is called out so you’re aware of the syntax to do CSV type exports!

Get-VMHost | Get-ScsiLun | Select VMHost, ConsoleDeviceName, Vendor, MultipathPolicy

// This will dump the Multipath Policy of the storage on the systems to determine what the MP configuration is.

Get-VMHost | Get-ScsiLun | Select VMHost, ConsoleDeviceName, Vendor, MultipathPolicy | Where {$_.Vendor –eq “NETAPP”} | Select VMHost, ConsoleDeviceName, Vendor, MultipathPolicy

// This will dump the Multipath Policy of ONLY NetApp systems

Get-VMHost | Get-ScsiLun | Select VMHost, ConsoleDeviceName, Vendor, Model, LunType, MultipathPolicy | Export-CSV “C:\temp\MultipathPolicyFull.csv”

// This will dump the Multipath Policy into a CSV as it’ll be a tad bit longer with multiple attributes specified!

Get-ScsiLun –Hba [software iSCSI HBA] | Set-ScsiLun –MultipathPolicy “RoundRobin”

// You can use these parameters to change the LUNs from Fixed to RoundRobin

e.g.) Get-ScsiLun –Hba vmhba39 | Set-ScsiLun –MultipathPolicy “RoundRobin”

Get-VMhost | Get-SCSILun | Where {$_.Vendor –EQ “NETAPP”} | Select VMHost, Vendor, MultipathPolicy

// Identify the Netapp LUNs

Get-VMhost | Get-SCSILun | Where {$_.Vendor –EQ “NETAPP”} | Where {$_.MultipathPolicy -EQ "Fixed"} | Select VMHost, Vendor, MultipathPolicy

// Identify the Netapp LUNs which are “Fixed”

Get-VMhost | Get-SCSILun | Where {$_.Vendor –EQ “NETAPP”} | Set-SCSILun –MultipathPolicy “RoundRobin”

// Set the NetApp LUNs to RoundRobin

Get-VMhost | Get-SCSILun | Where {$_.Vendor –EQ “NETAPP”} | Where {$_.MultipathPolicy -EQ "Fixed"} | Set-SCSILun –MultipathPolicy “RoundRobin”

Get-VMHost | Sort Name | Select Name, @{N=”NTP”;E={Get-VMHostNtpServer $_}}

// This will dump NTP Configuration settings

Get-VMHost | Get-View | foreach {$_.Summary.Hardware.OtherIdentifyingInfo[3].IdentifierValue}

// This will dump the Dell Service Tags

Get-VMHost | Get-View | Select Name, @{N=”Service Tag”;E={$_.Summary.Hardware.OtherIdentifyingInfo[3].IdentifierValue}}

// This will dump the Host name and the Dell Service Tag

Get-VMHost | Sort Name | Get-View | Select Name, @{N=”Tag 3”;E={$_.Summary.Hardware.OtherIdentifyingInfo[3].IdentifierValue}}, @{N=”Tag 2”;E={$_.Summary.Hardware.OtherIdentifyingInfo[3].IdentifierValue}}, @{N=”Tag 1”;E={$_.Summary.Hardware.OtherIdentifyingInfo[3].IdentifierValue}}

// This will dump the Host name and the Dell Service Tag values across all 3 identifiers

Get-View -ViewType HostSystem | Sort Name | Select Name,@{N="BIOS version";E={$_.Hardware.BiosInfo.BiosVersion}}, @{N="BIOS date";E={$_.Hardware.BiosInfo.releaseDate}}

// This will dump the hosts BIOS version and date(s)

get-vmhost | Get-VMHostAdvancedConfiguration -Name Syslog.global.logHost

// Dump the current SYSLOG Configuration

You may notice that a lot of the Scripts identified in here are very selfishly scripts I’ve personally used… and I’ll tell you… that’s not all that bad ;)   I figure as time goes on, I’ll find other various switches and flags which are important and others ought to check out!  I’m constantly building and adding to this list as there are various scripts I’ll be running on a daily, weekly and monthly basis.   As I start to identify which items fall into the lists I’ll share my experiences with ya’ll here! Enjoy!

Exchange 2010 Blasphemy, Virtualization and Rock Star Bloggers!

Today I was cleaning up my mailbox when I came across some BLASPHEMY about Exchange! Okay, not blasphemy per se, but I continually hear from folks who are being incorrectly told “Exchange cannot be virtualized”.  I’m not exactly sure who started this ‘trend’ but that’s neither here nor there!   So I did a little digging [and you know, digging for me tends to turn into a blog post ;)]  And I came across not only some AMAZING Material! But I also want to make sure you’re following up on regularly posted updates from a Rockstar who’s clear focus is on Exchange!

Virtualizing Microsoft Exchange 2010 with Confidence  Microsoft Exchange 2010 Zero-Data Loss Virtualization and Replication

These are two very SHORT and to the point, giving you the high-lights letting you know what is required to kick things off and something you can hand up to mgmt! So it’s great to not spend a lot of time trying to figure out what it’s saying!

One thing I’d like to bring particular attention on these papers is that these are not EMC Papers, but are in fact co-branded collaborations by Microsoft, EMC and others (the one below was Microsoft, Cisco and EMC, and some of the others involve Dell and Brocade) but either way, Microsoft was directly involved in their creation as opposed to ‘slap a tag on it’

STOP THE PRESS! (vicki vale!) – Check out this paper though!  It is definitely longer! 84 pages!  Filled with raw technical example, use cases, all that jazz! Great must read paper and not just words! Lots of pretty pictures!  Yes it is Hyper-V but that cmon, this was co-branded Microsoft.. :)  And note: Published October 2010! So Vicki Vale did get one thing right!

Business Continuity for Microsoft Exchange 2010 Enabled by EMC Unified Storage, Cisco Unified Computing System, and Microsoft Hyper-VWow, look at those DAGs!

Okay fine! Here is another paper! This one is a little older but I know you wouldn’t let me get away without giving you some VMware love! So here is one, with less pretty pictures!

 Microsoft Exchange 2010 Efficiency, Flexibility, Performance, and Availability at Scale Enabled by EMC Symmetrix VMAX, Virtual Provisioning and VMware vSphere VMAX it up!

Alright, one more then! This one was from August – not a whitepaper only a basic Reference Architecture, but I found it to be pretty damn cool looking!

 

EMC Virtual Infrastructure for Microsoft Exchange 2010 Enabled by EMC Symmetrix VMAX, VMware vsphere 4, and Replication Manager Pretty Reference Architecture

Okay, enough of these (albeit amazing papers!) With no further adieu I’d like to introduce you to Dustin Smith! I’d tell you all about him, but Brian interviewed him here so you can find out all about how he’s an MVP, MCM and so many other things!

So, Dustin has his own blog where he talks almost exclusively about Exchange (okay, I think it’s all about Exchange, but whatever! this is MY BLOG! ;))

Exchange In the Private Cloud is definitely a must check out blog if you care anything about Exchange, or have to deal with it!

I’d like to highlight a few of his blog posts here for you to check out:

  • Yes, Exchange Server is being virtualized!
    • Within EMC, our entire 40,000+ user infrastructure is virtualized on Exchange Server and the organization as a whole is moving towards virtualization of most all applications. Most all of the infrastructures we design and showcase within our Proven Solutions are geared toward virtualization, either with VMWare vSphere or Microsoft Hyper-V. See my previous blog post on what we recently did with the Tested Exchange Solutions Program case with Cisco and Microsoft where we showcased 34,000 users on Microsoft Hyper-V with Cisco UCS blade servers and EMC Unified Storage.
  • EMC Whitepaper, Exchange Tested Solutions Program
    • What we are showcasing in this whitepaper is a result of our joint solution development with Microsoft and Cisco that was deployed and tested in Microsoft EEC labs in Redmond. In the whitepaper you will find the reference architecture for 32,400 users across a three site Exchange DAG scenario leveraging Microsoft Hyper-V, EMC NS480 Unified Storage, and Cisco UCS B-series blade servers along with analysis of testing results and key best practices on virtualizing Exchange Server 2010 on Hyper -V on EMC Unified storage and Cisco Unified Computing System.
  • Exchange 2010 Backups? I don’t need any stinkin backups?!?
    • I think overall, the backupless/Exchange Native Data Protection option certainly brings a new element to the Exchange 2010 architecture discussions and different options for providing recovery when bad things happen. VSS based options (hardware and software based) are  still heavily used options to protect Exchange data that have been popular since the Exchange 2003 days and have increased with features and functionality into Exchange 2010.
  • Getting Exchange Server 2010 into the Private Cloud
  • Yes, EMC can do Exchange for SMB too

So, there are some teasers there of just some of the content that Dustin is putting out (There is obviously more.. but I’ll let you do the reading up on it! It’s definitely worth reading! – How so though, I just discovered Dustin TODAY and I’m sharing him with you a few hours after that point, So, yea I consider that to be pretty compelling :))

I want to leave you with links to all of the resources I mentioned above, so you can forth to gain access to the WP’s I mentioned and others I didn’t include pictures for!

There are so many more than just these links alone – I actually was surprised on how much content there was at www.emc.com/exchange ! – So check it out, and as always let me know if I can help you in a particular way :)