title: Put the knife down and take a green herb, dude. |
descrip: One feller's views on the state of everyday computer science & its application (and now, OTHER STUFF) who isn't rich enough to shell out for www.myfreakinfirst-andlast-name.com Using 89% of the same design the blog had in 2001. |
FOR ENTERTAINMENT PURPOSES ONLY!!!
Back-up your data and, when you bike, always wear white. As an Amazon Associate, I earn from qualifying purchases. Affiliate links in green. |
|
Thursday, December 18, 2014 | |
Well, for some reason I'm unable to post a comment to the blog entry here: http://blogs.vmware.com/PowerCLI/2011/09/list-and-disconnect-vcenter-sessions.html ... though it was still accepting comments, well, heck, three days ago. Must be work's network rules (though the error is coming from their server, so who knows??). Anyhow, just for the sake of posterity, here's what I *would've* said about that not-quite-finished script... <blockquote>$SessionMgr = Get-View $DefaultViserver.ExtensionData.Client.ServiceContent.SessionManager</blockquote> This isn't great, as if your connection has dropped but $DefaultViserver hasn't cleared out, it'll throw an error. Or, probably more likely, if <q>$DefaultViserver -eq $null</q> because you <i>did</i> bother disconnecting, you'll get, "The property 'ExtensionData' cannot be found on this object. Verify that the property exists," from the same line. So there's certainly an assumption in this function that you have an active connection when this function is called. Since we're implicitly encouraging folks not to leave connections open, that's not always even the preferred case. Probably easy enough to handle with <q>$DefaultViserver -eq $null</q> and a throw-catch, as those are possibilities I'd expect this sort of function to catch. Right? ;^) Labels: powershell posted by ruffin at 12/18/2014 09:19:00 AM |
|
| |
MarkUpDown is the best Markdown editor for professionals on Windows 10. It includes two-pane live preview, in-app uploads to imgur for image hosting, and MultiMarkdown table support. Features you won't find anywhere else include...
You've wasted more than $15 of your time looking for a great Markdown editor. Stop looking. MarkUpDown is the app you're looking for. Learn more or head over to the 'Store now! |
![]() |
|
|