Archives

powershell

Citrix Optimizer

What does it do?

I’ve always found the way operating systems evolve and adapt to be fascinating. They have more functionality with every release, their inner workings are more intelligent, they can automatically adapt to different situations, and are generally …


  

Related Stories

Continue reading..

Citrix Optimizer

What does it do?

I’ve always found the way operating systems evolve and adapt to be fascinating. They have more functionality with every release, their inner workings are more intelligent, they can automatically adapt to different situations, and are generally …


  

Related Stories

Continue reading..

Scripting Citrix XenServer with PowerShell and Command Line

In this blog post, it’s my aim to show you the most popular commands for Citrix XenServer in PowerShell and Command line, so you can use them in your automation workflow.

Because, as always, AUTOMATE EVERYTHING! Citrix XenServer is Linux-based, …


  

Related Stories

Continue reading..

The Art of Cyberwar

“If you know yourself, but not the enemy, for every victory gained you will also suffer a defeat.” 

― Sun TzuThe Art of War

There has never been a better time in history to work in cybersecurity. Crypto-currencies …


  

Related Stories

Continue reading..

Now Available: Citrix Studio Support for “BYO” Azure Resource Groups

Today I am pleased to announce support in Citrix Studio for provisioning XenApp and XenDesktop workloads into existing Azure resource groups. Until now, this popular “bring your own resource groups (BYO RG)” capability was available only via PowerShell as was


  

Related Stories

Continue reading..

XenMobile: Working Through REST API, Part 2

So, I promised you a part 2 in this series. This time, I want to deep-dive more into real-world usable PowerShell (PoSh) code. I will show you how my “framework” around XenMobile scripts work, and provide a link to scripts …


  

Related Stories

Continue reading..

What PowerCLI Version Am I On Anyways?

When PowerCLI was converted to modules, it introduced the ability to pick and choose which modules are loaded. Taking it a step further, it also allowed users to specify which versions of those modules are loaded. Historically, PowerCLI was released as one large &#lsquo;bundle&#rsquo; of modules, and was not a great release practice. This meant that even though most modules were not touched, we were still required to go through our release processes to get them out the door. This is not scalable when trying to get features to you more frequently.

With modules in the Powershell Gallery, we can now release individual modules asynchronously from other modules. The first release to really take advantage of that is PowerCLI 6.5.2. For those whom have already updated their VMware.PowerCLI module from the Microsoft PowerShell Gallery, you noticed there were only 3 modules which were updated and needed to be downloaded.

The Better Way

In prior releases, we could use the &#lsquo;Get-PowerCLIVersion&#rsquo; cmdlet and receive a high-level look at the overall PowerCLI version which was installed. Previously, our versioning scheme was not supported in PowerShell, so it took a cmdlet to print the version out (Example: VMware PowerCLI 6.5 R1). That is gone now. We&#rsquo;ve made the change to semantic versioning in 6.5.1. This means there will be no more R1, R2, or R3 releases!

Starting with PowerCLI 6.5.2, the process to get module versions has changed. Running the &#lsquo;Get-PowerCLIVersion&#rsquo; cmdlet now results in a warning message indicating that it is deprecated and to use the &#lsquo;Get-Module&#rsquo; cmdlet instead.

Using Get-Module

There are a couple ways to use the &#lsquo;Get-Module&#rsquo; cmdlet to help us determine our versioning. The reason for that is because the &#lsquo;Get-Module&#rsquo; cmdlet only shows the modules which have been imported.

The first way is to get the overall PowerCLI version, which is dependent on the &#lsquo;VMware.PowerCLI&#rsquo; module. We can determine the version by first importing the module (if it&#rsquo;s not already imported) and then running the following command:
Get-Module -Name VMware.PowerCLI | Select-Object -Property Name,Version

From the above example, we can see that we&#rsquo;re using PowerCLI version 6.5.2.

Another way is to just reference the modules which have been loaded automatically. I have an example where we connect to our vCenter Server and then run the following command to find the versions of all the PowerCLI modules which are in-use:
Get-Module -Name VMware.* | Select-Object -Property Name,Version

From the above example, we see that we&#rsquo;re only using a single PowerCLI module and it happens to be versioned at 6.5.2.

Running a couple additional, random, commands, we re-run the above command and see there&#rsquo;s now a bit more of a mix amongst our loaded modules.

Summary

The new method to obtain what version of PowerCLI you’re using is through the ‘Get-Module’ cmdlet. This update was made for many reasons. This new method takes advantage of how our the PowerCLI modules can be loaded independently of each other on an as needed basis. It also takes advantage of how the PowerCLI module releases can now be done asynchronously from each other. Lastly, since we’ve changed the PowerCLI versioning over to align with the standard PowerShell versioning, there&#rsquo;s no need for a custom cmdlet anymore!

If you’re using ‘Get-PowerCLIVersion’ in your scripts or modules, make sure you’re aware of this and update your resources to reflect this change!

The post What PowerCLI Version Am I On Anyways? appeared first on VMware PowerCLI Blog.

Read more..

Updating PowerCLI through the PowerShell Gallery

PowerCLI 6.5.2 has been released! This is the second release of PowerCLI to the PowerShell Gallery, so it&#rsquo;s time to figure out how to update your PowerCLI versions to the latest and greatest.

We&#rsquo;ll cover a couple scenarios:

  • Updating from PowerCLI 6.5.1, installed online from the PowerShell Gallery
  • Updating from PowerCLI 6.5.1, installed offline from the PowerShell Gallery
  • Updating from PowerCLI 6.5 R1 or prior

Updating from PowerCLI 6.5.1, Online

This will be the easiest update process PowerCLI has ever offered! Open a PowerShell session, type the following command:
Update-Module -Name VMware.PowerCLI -Scope CurrentUser

That&#rsquo;s it, you&#rsquo;re now running the latest and greatest PowerCLI release!

However, if you happen to have run into the following error it&#rsquo;s possible that PowerCLI was installed by the offline method:
Update-Module : Module &#lsquo;VMware.PowerCLI&#rsquo; was not installed by using Install-Module, so it cannot be updated.

There&#rsquo;s two main ways to resolve this:
Option 1. Remove the PowerCLI modules from where they currently reside
1a. Run the following command:
Get-Module VMware.* -ListAvailable
1b. There should be a &#lsquo;Directory&#rsquo; label at the top of the response. Browse to that directory and remove all the directories starting with &#lsquo;VMware.*&#rsquo;

1c. Perform the following command:
Install-Module -Name VMware.PowerCLI -Scope CurrentUser

Option 2. Use the force… And by that, I mean perform the Install-Module command with the &#lsquo;Force&#rsquo; parameter
2a. Perform the following command: Install-Module -Name VMware.PowerCLI -Scope CurrentUser -Force

Updating from PowerCLI 6.5.1, Offline

This process will work exactly the same as the installation process.

1. From a computer that has internet access, run the following command:
Save-Module -Name VMware.PowerCLI -Path C:PathToDesiredFolder
2. Take the downloaded modules and make them available to the offline system
3. Copy and replace the individual PowerCLI module folders to the location where the prior modules were placed.

Updating from PowerCLI 6.5 R1 or prior releases

If you happen to be running an older version of PowerCLI which involved an MSI installer, we can verify that by running the following command:
Get-Module VMware* -ListAvailable

If the majority of PowerCLI modules are versions listed at 6.5.0 or older, as shown above, proceed through the following steps.

PowerCLI 6.5 R1 (or older) Uninstallation Steps:
1. Uninstall PowerCLI through the Control Panel
2. Browse to the following directory: C:Program Files (x86)VMwareInfrastructure
3. If there is a &#lsquo;vSphere PowerCLI&#rsquo; directory, delete it

PowerCLI 6.5.2 Online Installation
This works exactly the same as how the installation did for PowerCLI 6.5.1.

Within a PowerShell session, type the following command: $PSVersionTable

If the PSVersion is a Value of 5.0 or above:
1. Run the following command:
Install-Module -Name VMware.PowerCLI –Scope CurrentUser
2. If asked to update &#lsquo;NuGet Provider&#rsquo;, choose &#lsquo;Y&#rsquo; to install and import the newer version.
3. If asked to &#lsquo;install modules from an untrusted repository&#rsquo;, choose &#lsquo;Y&#rsquo; to accept.

If the PSVersion is a Value of 4.x or 3.x:
1. Install a current version of PowerShellGet through one of the following two options:
1a. Install Windows Management Framework 5.1
1b. Install PackageManagement PowerShell Modules
2. Run the following command:
Install-Module -Name VMware.PowerCLI –Scope CurrentUser
3. If asked to update &#lsquo;NuGet Provider&#rsquo;, choose &#lsquo;Y&#rsquo; to install and import the newer version.
4. If asked to &#lsquo;install modules from an untrusted repository&#rsquo;, choose &#lsquo;Y&#rsquo; to accept.

PowerCLI 6.5.2 Offline Installation
1. From a computer that has internet access, run the following command:
Save-Module -Name VMware.PowerCLI -Path C:PathToDesiredFolder
2. Take the downloaded modules and make them available to the offline system
3. Copy and replace the individual PowerCLI module folders to one of the following locations:
3a. Local User Usage: $homeDocumentsWindowsPowerShellModules
3b. All User Usage: $pshomeModules

The PowerCLI Installation Walkthrough Video also works in this scenario too. However, following the instructions in the video will now result in PowerCLI 6.5.2 being installed:

The post Updating PowerCLI through the PowerShell Gallery appeared first on VMware PowerCLI Blog.

Read more..

XenMobile: Working Through REST API, Part 1

During my more than 20 years of consulting, automation has always been one of my priorities.

The key to automation is, for the most part, scripting. Luckily, these days, our products have public APIs and can be handled through a …


  

Related Stories

Continue reading..

Renaming Storage, Network or Datacenters When They Are Used with MCS (and PVS)

One of the issues that has faced both MCS and, to a lesser extent, PVS, is when you need to change the name of storage, network, or datacenter paths on your hypervisor after you already create HostingUnits/Resources and Catalogs, the


  

Related Stories

Continue reading..

Go Que Newsroom

Categories