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.

VMware
VCF, backup configuration

Backup implementation for VMware component is fairly easy. Just the requirements is to configure SFTP server in proper way and make it network available to the VMware components. SDDC Manager and NSX Manager backup In VCF Operations it is possible to configure backup for SDDC Manager and NSX Manager. Go …

VMware
VCF Automation, fresh environment configuration with identity providers and access control.

Introduction Login Login as user admin to the Organization name: system or if selected manual: Check the connections (in Administration section), where you should see connection to the vCenter and NSX-t manager as those are provided automatically via VCF Operations: the same for VCF Instances: Also check your networking: Identity …

VMware
VCF SoS

SoS (Supportability and Serviceability) command can be used for troubleshooting purpose to generate VCF (per component) log bundle, massively enable/disable ssh service on ESXi, vCenter, password and certificates expiry status, verify cluster health and many other. while troubleshooting, the following commands can be helpful: