SRM problem with PowerCLI version 11.1.0-11289667.

From time to time I am using my PowerCli scripts to produce SRM reports. Because of this “time to time” I didn’t noticed that version 11.1.0-11289667 was distributed with broken connection to SRM servers.
Simply speaking, PowerCLI module was not able to login into SRM server, and during connection attempt, cmdlet ends up with the following error:

Connect-SrmServer : 8/29/2017 12:51:33 PM       Connect-SrmServer               Cannot complete login due to an incorrect user name or password.

Solution was provided in this thread: https://communities.vmware.com/message/2831641#2831641. Anyway, I did not tried this solution. Instead of this, I noticed the newer version of PowerCLI available to download: VMware-PowerCLI-11.2.0-12483598

After I had grabbed this version, it turned out that it didn’t started to work from the scratch. I had to add the following explicit argument to Connect-SrmServer cmdlet to look like this:

Connect-SrmServer -IgnoreCertificateErrors -RemoteCredential $credential -Credential $credential

Below you can find script to generate raport from total count of vm configured in SRM configuration, total CPU and MEM used by them:

Connect-VIServer -Server vCenter_SERVER

$credential = Get-Credential -Message ‘Enter Password:’ -UserName ‘domain\user’
Connect-SrmServer -IgnoreCertificateErrors -RemoteCredential $credential -Credential $credential

$srmApi = $srmConnection.ExtensionData
$protectionGroups = $srmApi.Protection.ListProtectionGroups()

$srmapi = $defaultsrmservers.ExtensionData
$srmpgs = $srmapi.protection.listprotectiongroups()
$srmpgs

foreach ( $srmpg in $srmpgs){
foreach( $vm in $srmpg.ListProtectedVMs()){
$vms += (get-vm -id $vm.vm.MoRef)
}
}

Write-Host “VMs in SRM”, $vms.Count
Write-Host “Total CPU in SRM: ” ($vms | Measure-Object numcpu -sum).sum
Write-Host “Total MEM in SRM (GB): ” ($vms | Measure-Object memorygb -sum).sum

No Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Linux
Migrate WordPress site to another hosting service.

IntroductionThis article details the migration of WordPress site (exactly this site you are now on) from one service provider to Amazon Lightsail. There might be various reason to do that (mine is outlined below) but in general I hope to share the message that especially with WordPress, migration can be …

VMware
VMware Workstation and Fusion can be installed and use for free (even for the enterprise)

For a while now, the VMware Workstation (and Fusion for MacOS) can be used without any additional fee for Personal use. That was a great Broadcom news and nice gesture from that software vendor. Recently Broadcom announced that the software will be available for all, even the commercial sector. This …

Linux
Salt, VMware implementation – part 1, introduction

As every IT administrator knows, the infrastructure (meaning storages, compute, VMware virtualisation stack) is just a fundaments to run various operating systems (OS) and finally (containerized) application. Therefore, installation of (let’s call it) infrastructure in the datacenter (SDDC), in that sense is just the beginning of the adventure. No wonder, …