{"id":439,"date":"2019-03-01T18:09:29","date_gmt":"2019-03-01T18:09:29","guid":{"rendered":"http:\/\/labiol.xyz\/?p=439"},"modified":"2019-03-01T18:13:18","modified_gmt":"2019-03-01T18:13:18","slug":"srm-problem-with-powercli-version-11-1-0-11289667","status":"publish","type":"post","link":"https:\/\/www.labiol.xyz\/index.php\/2019\/03\/01\/srm-problem-with-powercli-version-11-1-0-11289667\/","title":{"rendered":"SRM problem with PowerCLI version 11.1.0-11289667."},"content":{"rendered":"\n<p>From time to time I am using my PowerCli scripts to produce SRM reports. Because of this &#8220;time to time&#8221; I didn&#8217;t noticed that version 11.1.0-11289667 was distributed with broken connection to SRM servers.<br>Simply speaking, PowerCLI module was not able to login into SRM server, and during connection attempt, cmdlet ends up with the following error:<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p> Connect-SrmServer : 8\/29\/2017 12:51:33 PM\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Connect-SrmServer\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Cannot complete login due to an incorrect user name or\u00a0password. <\/p><\/blockquote>\n\n\n\n<p>Solution was provided in this thread: <a href=\"https:\/\/communities.vmware.com\/message\/2831641#2831641\">https:\/\/communities.vmware.com\/message\/2831641#2831641<\/a>. 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<\/p>\n\n\n\n<p>After I had grabbed this version, it turned out that it didn&#8217;t started to work from the scratch.  I had to add the following explicit argument to Connect-SrmServer cmdlet to look like this:<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>Connect-SrmServer -IgnoreCertificateErrors -RemoteCredential $credential -Credential $credential<\/p><\/blockquote>\n\n\n\n<p>Below you can find script to generate raport from total count of vm configured in SRM configuration, total CPU and MEM used by them:<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>Connect-VIServer -Server vCenter_SERVER<\/p><p>$credential = Get-Credential -Message &#8216;Enter Password:&#8217; -UserName &#8216;domain\\user&#8217;<br> Connect-SrmServer -IgnoreCertificateErrors -RemoteCredential $credential -Credential $credential<\/p><p>$srmApi = $srmConnection.ExtensionData<br> $protectionGroups = $srmApi.Protection.ListProtectionGroups()<\/p><p>$srmapi = $defaultsrmservers.ExtensionData<br> $srmpgs = $srmapi.protection.listprotectiongroups()<br> $srmpgs<\/p><p>foreach ( $srmpg in $srmpgs){<br>     foreach( $vm in $srmpg.ListProtectedVMs()){<br>     $vms += (get-vm -id $vm.vm.MoRef)<br>     }<br> }<\/p><p>Write-Host &#8220;VMs in SRM&#8221;, $vms.Count<br> Write-Host &#8220;Total CPU in SRM: &#8221; ($vms | Measure-Object numcpu -sum).sum<br> Write-Host &#8220;Total MEM in SRM (GB): &#8221; ($vms | Measure-Object memorygb -sum).sum<\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>From time to time I am using my PowerCli scripts to produce SRM reports. Because of this &#8220;time to time&#8221; I didn&#8217;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 &hellip; <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"class_list":["post-439","post","type-post","status-publish","format-standard","hentry","category-vmware"],"_links":{"self":[{"href":"https:\/\/www.labiol.xyz\/index.php\/wp-json\/wp\/v2\/posts\/439","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.labiol.xyz\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.labiol.xyz\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.labiol.xyz\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.labiol.xyz\/index.php\/wp-json\/wp\/v2\/comments?post=439"}],"version-history":[{"count":8,"href":"https:\/\/www.labiol.xyz\/index.php\/wp-json\/wp\/v2\/posts\/439\/revisions"}],"predecessor-version":[{"id":447,"href":"https:\/\/www.labiol.xyz\/index.php\/wp-json\/wp\/v2\/posts\/439\/revisions\/447"}],"wp:attachment":[{"href":"https:\/\/www.labiol.xyz\/index.php\/wp-json\/wp\/v2\/media?parent=439"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.labiol.xyz\/index.php\/wp-json\/wp\/v2\/categories?post=439"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.labiol.xyz\/index.php\/wp-json\/wp\/v2\/tags?post=439"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}