Powershell Open File Dialog Box

Do you ever require the users of your script to select which file to use?

I do. And it’s no fun trying to do decent error-handling when a user has to type the full path to a file. Nor is it any fun to be that user. So why not use the Windows Forms class of .Net to show the Open File Dialog Box?

Select-FileDialog function (rename to .ps1 or copy into your profile)

User happy. Me happy. You happy?

nba draft picks come up short compared to nfl top rookiesIt’s the only game with a well represented mixture of whites, Latinos, African Americans and Asians. However, the relationship between low Cheap Oakleys spatial resolution in ERG and localized morphological changes is complicated.. At that time, and for kate spade the first two months of the war, I happened to be in Poland, and I remember perfectly well that, when those precious kate spade outlet documents came out, the confidence in the moral turpitude of mankind they implied did not even raise a scornful smile on the Moncler Outlet Store lips of men whose most sacred feelings and dignity they outraged. He also added that he wished the best for Kokinis and his family. And you will either screw the legs in or screw them out to make one side higher or lower depending on what the level tells you. There was a 30 Authentic Jerseys Wholesale basis point benefit from franchised locations sold to the company in the last 12 months. Dozens cheap oakleys of renderings of other would be NFL stadiums in the Los Angeles area have come and gone in the two decades since the Rams and Raiders left. Kingfisher East Bengal kept its date with history in style retaining the eighth edition of the National League with two rounds to spare. You fight until you can’t fight any more. Ridiculous. His trainers dosed up with brandy and strychnine and he collapsed and almost died after crossing the finishing line. Nintendo’s new game console is not expected to be released until mid 2017.. Better yet, he has the cheap football jerseys always important marquee Heisman moments not one, but two. It’s called experiencing adulthood. In addition, we expect the full year share Replica Oakleys count to be approximately 159 million shares, interest expense of approximately $190 million and amortization of intangible assets of approximately $95 million. Cut out small pieces of construction paper and fashion it in decorative accents or make 3 D Cheap NFL Jerseys China designs by gluing and scrunching different color construction paper to different areas are the sides of the helmet. Information regarding the extent of retinal damage comes mainly from studies on animals.1, 2, 3 Experimental studies in rhesus monkeys with transient central retinal artery occlusion (CRAO) produced by temporarily clamping the CRA at the site of entry into the optic nerve resulted discount football jerseys in irreversible damage in the ganglion cell layer and the inner nuclear layer for an occlusion duration of 240 min.2 Total or almost total optic nerve atrophy and nerve fibre damage were also evident.3 Although structural damages can be examined in detail in experimental models, it is more difficult, if not impossible, to evaluate the corresponding functional change in animals.

Setting Video Hardware Acceleration Level

It’s about time I follow up on the post Getting Video Hardware Acceleration Level.

I have created a simple, fire-and-forget script that sets the Hardware Video Acceleration Level for all your (Windows Server 2003 and Powered On) VM’s to Full. This way you can always enjoy smooth mouse movements when working in the console!

Set-VMVideoAccLevel (Rename to .ps1)

Enjoy!

5 superpowers science will give us in our lifetimeSubscribe to USA TODAYAlready a print edition subscriber, but don’t have a login?Activate your digital access.Manage your account settings.My AccountLog OutDENVER The Denver Broncos talked all week about being physical. And players said they could tell as the season opening Super Bowl 50 rematch went on Thursday night that the hits were adding up on Carolina Panthers star quarterback Cam Newton.”I could in the second half, yeah,” Broncos safety Darian Stewart cheap oakleys Sunglasses Online told USA TODAY cheap jerseys china Sports after the defending champs rallied for a 21 20 triumph. The Age newspaper pioneered an early version of the AFL Dreamteam in the early 1990s, and in the football underground, many private leagues have flourished since then. However, NFL Jerseys Cheap it took the internet for the cult to become a mainstream craze in Australia, with many media outlets now running a version of an online fantasy game.American wholesale football jerseys Capital Agency Corp. is a real estate investment trust that invests in agency pass through securities and collateralized mortgage obligations. government sponsored entities. The company funds its investments primarily through short term borrowing structured as repurchase agreements. The current yield for this company is 14.9%, as it distributes $1.25 per share a quarter. Below is a chart to show how well this equity has performed over the last year.He’s played sparingly since.The Raiders and Lions said in separate statements that the teams hope the men will be rescued and that their thoughts and prayers go out to their families. Coast Guard helicopter crew member (R) reaches out to pull a man, identified by the Coast Guard as Nick Schuyler, from a transport basket into the Cheap Jerseys helicopter after the man was rescued from the waters of the Gulf of Mexico, off the coast of St. Remember that adding weight should come second place to achieving full range of motion with good form. My training philosophy asks for lifters to move well, and then get stronger while moving well. Your mobility comes first. Learn to move well using the squat, and you have some of the most productive workouts you ever had.At the Drone Racing League, we design and build all of the drones that are used in our events. So we’re bringing over a hundred drones to an event, so it’s a sizable team of people that are drone engineers and fleet managers that keep all those drones in http://www.cheapnfljerseyssu.com pristine working order.Regardless that cheap nfl jerseys England is amongst 1 of many favorite teams in South Africa this season, they aren beneficial for your World Cup betting swimming pool. Unusual answer from an Englishmen? Possibly, nonetheless, if there is surely anything this is significant in sports betting, it definitely is counting on the statistics and background work rather than selecting your favorite team.

Setting of advanced options with the VI Toolkit

It’s a bit tricky to find, but the API reference showed me where to look. And now I’m posting it here, so you don’t have to search any further.

First, connect to the Option Manager:
$SI = Get-View $ServiceInstance
$OM = Get-View $SI.Content.Setting

Query current values of advanced options:
$OM.QueryOptions(‘ADV_OPTION_NAME’)

To change or add an advanced option:

Create a new object to hold the new settings.
$newOption = New-Object VMware.Vim.OptionValue

Set the Key and Value you would like to add or change.
$newOption.Key = ‘ADV_OPTION_NAME’
$newOption.Value = 300

Use the UpdateOptions method to execute the change.
$OM.UpdateOptions($newOption)

Tadaa! 🙂

After school there’s nothing, they turn to their friends and get caught up in whatever. Bar graphs represent the mean of three independent assays. So on October 8, 1965, when Koufax decided to skip the Dodgers’ first game of the World Series against the Minnesota Twins, which fell on Yom Kippur his decision made headlines and sparked controversy around the country, but also became a source of great pride among American Jews. Neuralstem’s treatment for ALS, NSI 566, got widespread media coverage just as http://www.ray-banbaratas.top the company’s Phase I trials were concluding, when at least two patients began showing signs of stabilization. The stronger LB will be facing the side of the opposition which is a greater threat. You’re not here for a biology lesson, but without PCR, we basically wouldn’t be able to study DNA. And, more specifically, that despite playing Peyton Manning (5,477 yards, cheap ray ban Sunglasses outlet 55 touchdowns, 10 INTs), the veteran quarterback is 9 11 in the postseason and 3 5 in divisional playoff matchups. So it’s not something we’re Wholesale NFL Jerseys Online concerned about.. He has passed the ball to ‘Homer Jones’ who has completed 35 yards, and has passed the possession to ‘Aaron Thomas’ who is moving into the Redskins area . He played for the NFL in the late ’60s and early ’70s. Start off by holding a good Cheap NFL Jerseys 10 seconds if you can. Kaepernick is in competition to win back the Cheap Football Jerseys starting quarterback job in San Francisco that he lost to cheap nfl jerseys Blaine Gabbert last season. Subscribe to USA TODAYAlready a print edition subscriber, but don’t have a login?Activate your digital access.Manage your account settings.My AccountLog OutDez Bryant of the Dallas Cowboys argues with Josh Norman 24 of the Washington Redskins after catching a pass in their game at AT Stadium on November 24, 2016 in Arlington, Texas.(Photo: Ronald Martinez, Getty Images)ARLINGTON, Texas Dallas Cowboys wide receiver Dez Bryant and Washington Redskins cornerback Josh Norman had to be warned by officials during the game because their words and actions were getting a little too heated in the second half.The end of the game didn’t calm anything down.Norman and Bryant went mask to mask and had a heated exchange on the field after the Cowboys’ 31 26 win and had to be separated by teammates.Once both players retreated to their respective locker rooms, the fireworks continued. And, like any great relationship, it just gets better and cheap nfl jerseys better as the years roll on. We are still tracking early in the story of users consuming sports through social media. I walked by him a few times in the hallway, which was, you know, kind of bizarre and weird.

Track Datastore Free Space

I’ve got a great new script for you today!

We all love VMware for consolidating our servers. And we all know that virtualization requires lot’s of SAN space. But how do you keep track of the amount of space left on all your datastores? It’s pretty easy to create a report using the Powershell VI Toolkit. But who is going to read all those reports and compare them to yesterday’s values? You will most likely end up with a mailbox full of reports and still be surprized when yet another datastore fills up.

PeetersOnline to the rescue! How about storing the report every day and comparing today’s values to yesterday’s values? Then you can email yourself only the differences. The overview shows the datastores that changed since yesterday, the change rate and the current value. This way, you can easily assess if the datastore is about to fill up.

Because it is quite a large script (in Powershell terms) and it contains long lines that are not easily readable on my site, I have attached the script for you to download. It contains lot’s of comments, so you should be able to follow exactly what it does and how it works. If not, post a comment.

Enjoy!
Hugo

Track-Datastores (Rename to .ps1)

Like the Raiders, Centerra has been a survivor, but for how long is anyone’s guess.. Just yesterday, we announced a renewal and expansion of our agreement with Amazon to stream a large amount of library programming. Since these muscles fold the hips forward, as well as attach to your lumbar spine (low back), they can cause the hips to tip forward and the spine to shorten when they are too tight.. And we struggled with knowing we could have done better there,”Verhaeren recalls.. Emory University neurologist, Dr. So not only did the Pats look to limit their quarterback’s activity on the day. A near capacity crowd of 29,843 filled Melbourne’s AAMI Park to watch Melbourne Victory defeat Sydney FC, but come the first Saturday in October the MCG will be filled with about 100,000 spectators witnessing the fight for the AFL’s 2015 premiership.. The materials that you will need are a really great cheap China Jerseys supportive pair of cheerleading tennis shoes, a nice, loose fitting pair of shorts, and any type of a T shirt that is long that will cover your torso. Deep on your tummy and up, resist on the way down. He, the boyish blond, with a shoeshine and a smile; lifetime league functionary, promoted to a $40 million a year position thanks to the Peter Principle. Bix Beiderbecke: Beiderbecke was a pioneer in bringing about the jazz ballad genre, and his takes on ‘Singin The Blues’ and ‘I’m Coming Virginia’ were received well all over. Jessie Hunter started the breakthrough in the bottom of the third inning with a lead off single to center field. Choose a good team. Matt Ryan is not necessarily the be all and end all of Replica ray ban Sunglasses sale the team, but if he gets sacked as many times as he was last year (44 ), then a place in the playoffs looks unlikely. Your knees should be above your ankles at 90 degrees. But his contract ends Feb. No extra movements needed. Sarafin revealed to the magazine that he began telling his teammates that he was gay last spring. Is an organ donor, and we hope this will enable her to save many lives and live on through others. Griffith’s top victories have came against: Luis Rodriguez, Dick Tiger, Nio Benvenuti, Bennie Brisco, Benny Paret, and Ralph Dupas. If Wholesale China Jerseys the Celtics seem like they’re in some sort of NBA purgatory, not exactly built for a title, but not bad enough to find themselves in perpetual lottery pursuit (thank you, Brooklyn), at least they can wholesale jerseys china boast deliveries like this one in April. Brian has http://www.cheapjerseys11.com now become the quarterback shooting target and this is really what it’s about. Of course, I can’t make the 6 in the corner with the 9 blocking it so I would bank the 6 and I would just say, “6 ball in this corner.” So, that means, like I said earlier, this ball could by some luck hit some other stuff, go around, carum, cushion, as long http://www.cheapraybansunglasseser.com as it goes in this cheap ray bans pocket, it’s a good shot, it’s legal.

VMware Stats Oneliner

Today’s oneliner is a nifty little function that reports the average CPU and Memory usage for one or more of your VMs, calculated over the last x hours:

function Get-VMStat
{
param( $VM,[Int32]$Hours = 1 )
 $VM | Sort Name |
 Select Name, @{N=”CPU”;E={[Math]::Round((($_ |
 Get-Stat -Stat cpu.usage.average -Start (Get-Date).AddHours(-$Hours) -IntervalMins 5 -MaxSamples ($Hours*12) |
 Measure-Object Value -Average).Average),2)}}, @{N=”MEM”;E={[Math]::Round((($_ |
 Get-Stat -Stat mem.usage.average -Start (Get-Date).AddHours(-$Hours) -IntervalMins 5 -MaxSamples ($Hours*12) |
 Measure-Object Value -Average).Average),2)}}
}

A great way to use it is like this:

Get-VMStat (Get-VM) -Hours 4 | Where {$_.CPU -gt 50 -or $_.MEM -gt 75}

I’m sure you can figure out what that does. Be the first to give the correct answer in the comments to win everlasting glory! (or at least until the next oneliner…)

Enjoy!

Told me I could lose my eyesight, or I could lose my legs,” Berry said in an interview with The Daily Mail. Shares have increased 10% since that time, but continue to be undervalued. He finished fourth at Talladega, but was 22nd at Martinsville. “With one hospital using one EEG system and another using another system, Cheap NFL Jerseys the electrode positions might be different, for example, and it’s hard to integrate the data.” (Read “Beyond the Brain” from National Geographic magazine.). Now I want you to place that heavy weight down and take those arms above your head, we’re just going to do 10 triceps. Attach a pen to the bulletin board, and encourage employees to write down their guesses. It’s a fact that content is compressed in streaming, but it doesn’t affect the quality of the video. For example, in a house with four guys, they only get to keep the seat up when there are two or fewer girls; for five guys, three or fewer cheap nfl jerseys girls (if you NBA Jerseys Cheap start adding in variables such as multiple bathrooms http://www.cheapjerseys11.com and proximity of bathrooms to males and Cheap nfl jerseys females, then you’d need some kind of supercomputer to figure it out).So there you go. He had been given a standing ovation from the crowd of 22,502 earlier after a dazzling seventh ODI century compiled over all but 19 balls of the Australian innings of 8 324. So it should come as no surprise that he’s spent the last decade headlining the Luxor in Las Vegas, where he no doubt has eaten at least a few plates of complimentary breakfast. When the system is turned on in the spring, you’ll have gushers, not sprinklers. Hambrecht is also no stranger to professional football and its inner workings. Barrett all come to mind and we’re only halfway through the season.But there is another quintet of exciting players gaining steam, none of whom had especially healthy oddsas Wholesale China Jerseys the year began. In one he found some copper money and a thimble. It’s simply that people are changing how they consume sports media content. Jessica’s new fragrance comes in a shapely bottle not unlike its designer and is even adorned with a lovely feather motif. His jab, footwork, timing and accuracy were his trademarks inside the squared circle. For now, it’s not available on Chromecast or Apple TV.. The 61 year old is as ambitious, as competitive, as any Premier League manager. The title of the video parody is “We’re NASA and We Know It”. His sincerity is clear during interviews. Neither subject had clinical signs suggesting DP, however. He shocked everyone by trading TE Jimmy Graham. And the Wholesale China Jerseys free safety’s job is, don’t let anything go long. And instead of overweight middle schoolers in gym class, the players were Vikings. This will make the job of checking items much more efficient and effective.

Oneliner of the day

Do your fellow VMware Admins sometimes forget to fill in the Notes field for a new vm they create? Or would you like to change those inconsistent notes to something more accurate? Todays oneliner simply copies the Active Directory description field into your Virtual Infrastructure. It’s quite blunt about it. Besides asking if you really want to do so, it shows a lot of errors for servers that are powered off or cannot be found in AD. But it pretty much does the trick.

Get-VM | ForEach { Set-VM -VM $_ -Description (Get-QADComputer ($_ | Get-View).Guest.HostName.Split(“.”)[0]).Description }

If your vm’s always have the same name as defined in the VM Guest OS, you can suffice with:

Get-VM | ForEach { Set-VM -VM $_ -Description (Get-QADComputer $_.Name).Description }

If you want more advanced description synching, check out the full script.

Enjoy!

“Two years ago, I said something about the Academy being very Cheap Jerseys white male, which is the reality, and I was slashed to pieces by the media. Your email address will not be published. The Packers were 25th in the league in sacks, and with as much man coverage as they play, a strong pass rush is crucial to the overall effectiveness of this unit. wholesale football jerseys They are no longer just reading an essay that someone has written, rather an essay someone they can relate to such as “The time we were comparing which brands were the best pots and pans and somehow it led to us.”. March believes cutting the season so that all teams play one another once will remove the inequity of unfair differences between clubs over the teams they play twice.. Rangers do receive hazard duty pay, and jump pay, depending on what kind of unit they’re in. http://www.foakleysaaaa.com The NFL Players Union and the players signed off on that CBA, so they gave Goodell all of that power he used when he “Dispensed his own brand of justice.” Besides, it’s obvious that Brady is guilty.. Read it. Power sellers on E bay and other online auction sites are also benefiting from online FUBU wholesale suppliers. Another is the slowed pace of real action. You can use wholesale jerseys a wobble board or wobble cushion, or simply take a cushion off your couch. On an average, Tom Cruise gets paid somewhere between $10 million to $12 million per film , however, the figures change drastically when it comes to his blockbuster Mission Impossible series, of which he is also the producer. While holding the bar in front of your thighs, lift your shoulders straight up in the air and hold for a second. Paint, carve or finish the fence posts any way you like. The number of opportunities Green Bay had to win this game is close to countless. The week that your team gets to star on the prime time event is always a big deal.. They know what he’s going to do and then they’re going to force him to actually throw the football. But despite his routine denials of any significant long term risks associated with concussion and dismissing the incidence of CTE as ‘almost zero’, there is no record www.foakleysaaaa.com/home/fake-oakley-sunglasses-sale/ of McCrory ever conducting original research into CTE. For the first time in recent memory, three NFL franchises with close ties to LA are on what amount to be year to year leases. But those venues with vision can see the value in having the All Blacks play.”Rugby has a growing profile in Germany and the country has excellent stadia, having hosted the football World Cup Fake Oakleys Sale in 2006.Tew said the NZRU has a long term vision to play tests at neutral tests as long as they don’t place excessive demands on the players and stretch the All Blacks to the point they can’t sustain their winning legacy.Hawke’s Bay TodayMcDonald’s ‘stabbing’ in Napier Two people were taken to hospital after a Cheap Oakleys Sale fight in Napier McDonald’s last night..

Some Advice on Creating Powershell Scripts (Part 2)

Part two in Some Advice on Creating Powershell Scripts

Now that you have found all sort of interesting properties, you might feel the urge to modify one or two. After all, creating slick overviews is cool, but bricking your entire infrastructure with one script is … well, you get the idea. Continue reading “Some Advice on Creating Powershell Scripts (Part 2)”

How many VMs in each LAN?

A nice challenge today, when trying to answer a question in the VMware VI Toolkit community:

How to get an overview of all my networks and the number of VMs connected to each of them?

It’s unfortunately not possible to get VMs, based on which port group they are connected to. So something like this will NOT work: Get-VirtualPortGroup | Get-VM. Let’s try to do it the other way around: Get all the VMs we have. Get the portgroups they are connected to. And then figure out a way to invert the table.

First step: Getting the VMs and their port groups:

$VMs = Get-VM | Select Name, @{N=”PortGroups”;E={Get-VirtualPortGroup -VM $_ | %{$_.Name}}}

OK. That wasn’t too bad. The old Get-VM doing it’s job there. And the Get-VirtualPortGroup can return all port groups for each vm. We are only interested in the name of each port group, though. Using Calculated Properties we can stuff it into a single line.

Now to turn this table around. Piping to Group-Object does not quite deliver the desired result. That’s because some VMs have multiple port groups assigned. Group-Object then groups by each unique combination of port groups instead of per unique port group. Bummer. Let’s just try to list all unique port groups first then:

$PGs = $VMs | %{$_.PortGroups} | Select -Unique

Hey, that’s pretty simple. Now a small script can build a new collection of objects representing port groups for us. And we can definitely calculate how many vms there are associated to each port group, by using the $VMs collection we created earlier!

$myCol = @()
ForEach ($PG in $PGs)
{
  $myObj = “” | Select PGName, NumVMs
  $myObj.PGName = $PG
  $myObj.NumVMs = ($VMs | Where {$_.PortGroups -contains $PG} | Measure-Object).Count
  $myCol += $myObj
}

That ought to do the job. Let’s give it a nice, orderly view and we’re good to go!

$myCol | Sort NumVMs -Descending | Format-Table -AutoSize

Mystery solved!

»crosslinked«

Some advice on creating Powershell scripts

Creating a Powershell script CAN be quite difficult. How to get the output you want? Where to start? Let me try to get you started by providing a structure you can follow. I’m not saying this is THE way, but it’s MY way. Hope it helps you and please do comment if you have additions or another way!

First: Scripts for gathering information.

1. What should my OUTPUT be?
It’s easier to start with the end. Start by determining what you would like your output to look like.

1.1 OBJECTS representing what?
It’s good practise generating objects as output. It allows you to use the full power of Powershell to further manipulate your output. So don’t use any Format-… cmdlets in your scripts! That being said, what should the output objects represent?
Let’s take a simple example, like generating an overview of server OS versions or free disk space or something similar. The output objects should represent the servers.

1.2 What PROPERTIES?
You all know objects have properties. If not, read Get-Help About_Object. What properties of the server objects are we interested in? In the example it could be Server Name (obviously), OS Version, Service Pack, Free Disk Space on C-partition, and so on.

2. WHERE to get the information?
Now that we know what objects to create and what properties to fill, let’s examine where to get all this info.

2.1 The EASY ones.
When the properties can all be found in one place, the script is simple. For example, the OS Version and Service Pack of a server, can all be found in Active Directory. The Quest AD cmdlet Get-QADComputer returns objects representing servers, which have properties including the ones we seek. All we have to do is FILTER the properties, like so:
Get-QADComputer | Select-Object Name, OSName, OSServicePack

And we’re all done!

2.2 Getting HARDER:
What if most properties can be found in this way, but some require additional calculations or “get-“ting? Then we can use CALCULATED PROPERTIES. The syntax is as follows:
Get-Something | Select-Object Name, @{N=”CalculatedPropertyName”;E={EXPRESSION THAT RETURNS THE DESIRED VALUE}}
For example, you want to get several properties of a harddisk, but one value should be converted from bytes to GB:
Get-WmiObject Win32_LogicalDisk | Select-Object DeviceID, @{N=”GBFreeSpace”;E={$_.FreeSpace/1GB}}

2.3 The CHALLENGE:
The most difficult scripts gather information from all over the place. But you’d still like to present it in a simple and convenient manner. This is when you should build your own output objects and create the properties yourself. In order to get this done for multiple objects in a collection, it is vital you loop through a collection of objects representing the same thing as your output objects. Consider the following example:
Let’s say you want to get some exotic characteristics for all your vm’s. For instance which server it is running on, the last 5 events that occurred and the average memory usage. These aren’t properties of any vm object you can get. So start by looping through all the vm objects you can get, but not before you create an empty collection to old your output objects:
$myCol = @()
$VC = Connect-VIServer MYVCSERVER
$vms = Get-VM
ForEach ($vm in $vms)
{
Then, inside the loop, create a custom output object along with the properties you’d like to see:
$myObj = “” | Select Name, Host, LatestEvents, AvgMemUsage
Then you can start calculating or “get-“ting the proper values for each of these properties. For example:
$myObj.Name = $vm.Name
$myObj.Host = ($vm | Get-VMHost).Name
$myObj.LatestEvents = ($vm | Get-Event | Select-Object -Last 5)
$myObj.AvgMemUsage = ($vm | Get-Stat -Memory -MaxSamples 1).Value
(These examples are off the top of my head and untested.)
Finally, add your output object to the collection and close the loop:
$myCol += $myObj
}

Next time: Scripts that actually change values or perform some other action. Stay tuned.
Hugo

Changing your VMware license server

Hi everybody, I’m back!

Before you ask, I’ve had a great holiday, thank you. Now let’s continue having fun with Powershell and the VI Toolkit!

I’ve showed you a trick earlier that allows you to find your Virtual Center Server Settings. The License Server settings for instance. But changing these settings can prove to be quite a challenge. Let’s take a look:

$SI = Get-View ServiceInstance
$LicMan = Get-View $SI.Content.LicenseManager

This is the way we connected to the License Manager. Get-Member shows us that the $LicMan variable has a method called ConfigureLicenseSource. This method required two parameters: first a reference to the ESX server and second an object with the new license server settings.

The “managed object reference” to the ESX server took some time to figure out, but it’s actually quite easy:

$ESXServerName = “ESXSERVER01”
$VMHost = Get-VMHost $ESXServerName
$hostref = ($VMHost | Get-View).MoRef

By now, you should know how to use Get-View a bit. The resulting object has a MoRef property which can be used in the ConfigureLicenseSource method.

The object containing the new license settings was also a bit of a puzzle. The method shows it wants an object of type “LicenseSource”. But after consulting the VMware Infrastructure API Reference, I found this type of object has no properties! Then how to set the license server name and port?
More searching yielded a different type of object “LicenseServerSource”. This object type has a property called LicenseServer, which accepts a string as input. This object extends the LicenseSource object (according to the API Reference) and it turns out you can use it in the method:

$LicServer = “27000@LicenseServer.domain.local”
$licsrc = New-Object VMware.Vim.LicenseServerSource
$licsrc.LicenseServer = $LicServer

Now we have all the info we need, and we can execute the method:

$LicMan.ConfigureLicenseSource($hostref,$licsrc)

Enjoy!