VJ_VMware_111's Posts

Hello, I followed the instructions and got the below error. I did restart both vCenter Service as well as vCenter Single Sign on service, but for no avail. Please help. Please note our vCen... See more...
Hello, I followed the instructions and got the below error. I did restart both vCenter Service as well as vCenter Single Sign on service, but for no avail. Please help. Please note our vCenter is installed in D:\VMware\Infrastructure. However i cannot find JRE folder in this location, but i can find it at the default location : C:\Program Files\VMware\Infrastructure\jre. Hence ran the command : SET JAVA_HOME=C:\Program Files\VMware\Infrastructure\jre. D:\VMware\Infrastructure\SSOServer\ssolscli>ssopass -d https://sdmprdvctris04:7444/lookupservice/sdk username Intializing registration provider... Getting SSL certificates for https://sdmprdvctris04:7444/lookupservice/sdk Unable to connect to server Unable to connect to server Return code is: ServiceNotResponding 2 D:\VMware\Infrastructure\SSOServer\ssolscli>ssopass -d https://sdmprdvctris04:7444/lookupservice/sdk administrator@vsphere.local Intializing registration provider... Getting SSL certificates for https://sdmprdvctris04:7444/lookupservice/sdk Unexpected status code: 404 Unexpected status code: 404 Return code is: ServiceNotResponding 2 Thanks a lot. .
Hello Gurus, We have a vCenter 5.1 Server, whose SSO administrator@vsphere.local password has expired recently. We tried to do a password reset as mentioned in the below link, but it is failin... See more...
Hello Gurus, We have a vCenter 5.1 Server, whose SSO administrator@vsphere.local password has expired recently. We tried to do a password reset as mentioned in the below link, but it is failing as shown in the attachment. We do not have any other user accounts that has rights on the SSO. Also, since there is some issue with identity source, no one is able to login for now. As you know, VMware support has ended since it is 5.1. Please help. VMware vSphere 5.1 Thanks.
Hello Experts, Hope you are doing well. I am trying to migrate ESXi 6.5 Management Network VMKernel port from Standard to Distributed Switch using Migrate Network in vCenter, as mentioned in t... See more...
Hello Experts, Hope you are doing well. I am trying to migrate ESXi 6.5 Management Network VMKernel port from Standard to Distributed Switch using Migrate Network in vCenter, as mentioned in the below article. Migrate VMkernel Adapters to a vSphere Distributed Switch As soon as i hit finish on step 11, these things happen, in order. 1. vCenter loses connectivity with ESXi host. ESXi host goes to not responding state. 2. ESXi does not come in network on its own even after several minutes. 3. In DCUI, it shows all the NICs as disconnected. 4. As soon as i select a NIC in DCUI, it comes back in network. 5. ESXi connects back to vCenter, but the Management network VMKernel port is still in Standard Switch. I double checked VLAN tagging on both source (vSS) and destination (vDS), and they are same. Both has one uplink, which shows observed IP ranges in the same VLAN. What is the fix for this issue? How can i migrate Management network of my ESXi host from vSS to vDS in 6.5 ? Thanks.
That is to renew Cert for one ESXi host. I need to know how to do it for all ESXi hosts that are already connected to the vCenter server. By the way our vCenter server is 6.0 U1b/U2.
Hi Guys, Do you know how to renew or reissue all ESXi hosts certs signed and issued by VMCA, at once? The ESXi hosts already have certs from VMCA, but the settings on the cert is default, and ... See more...
Hi Guys, Do you know how to renew or reissue all ESXi hosts certs signed and issued by VMCA, at once? The ESXi hosts already have certs from VMCA, but the settings on the cert is default, and we have modified the settings. Now we want VMCA to reissue all the certs to the already connected ESXi hosts. The goal is to reissue all the ESXi certs generated by VMCA, via webclient or powercli, without changing the VMCA cert itself. Note that VMCA is an intermediate CA in this case. Let me know. Thanks in advance. Thanks, VJ
Thanks LucD. This time the script ran in 4 hours 46 min for ~15 VCs, which is very fine with us, as compared to 15 hours like in the beginning of the thread. We are good now. Thanks.
LucD, If i try to integrate this with the main host script, i am not getting anything for ownership. Even without creating a separate function is not working. Can you please help here? $Ho... See more...
LucD, If i try to integrate this with the main host script, i am not getting anything for ownership. Even without creating a separate function is not working. Can you please help here? $HostReport = @() $owner = @{} function getowner {$owner.GetEnumerator() | ?{ $_.entity.name -eq $args } | Select -Expandproperty tag | Select -ExpandProperty Name} Connect-VIServer vcenter1    $owner = get-tagassignment     Get-View -ViewType HostSystem -Property Name,Parent,Runtime.ConnectionState,Config.Product,Hardware,VM -Server $vcenter | %{         $obj = [ordered]@{             vCenter = $vcenter             Hostname = $_.Name             Ownership = getowner $_.Name             IP = get-vmhostnetworkadapter -vmhost $_.name -name vmk0 | select -Expandproperty IP             Cluster = &{                 $parent = Get-View -Id $_.Parent -Property Name,Parent                 while($parent -isnot [VMware.Vim.ClusterComputeResource] -and $parent -isnot [VMware.Vim.Datacenter]){                     $parent = Get-View -Id $parent.Parent -Property Name,Parent                 }                 if($parent -is [VMware.Vim.Datacenter]){                     ''                     $script:sa = 'Yes'                 }                 else{                     $parent.Name                     $script:sa = 'No'                 }             }             Stand_Alone = $script:sa             State = $_.runtime.connectionState             ESX_Version =$_.config.product.version             Build =$_.config.product.build             Model =$_.hardware.systemInfo.model             CPU_Sockets =$_.hardware.CpuInfo.numCpuPackages             CPU_Cores =$_.hardware.CpuInfo.numCpuCores             RAM_GB = [math]::Round((($_.hardware.memorySize)/(1GB)),1)             VM = $_.vm.Count         }         $HostReport += New-Object PSObject -Property $obj     }     $owner = @{} $HostReport | Export-Csv "C:\Results\HostReport.csv" -NoTypeInformation -UseCulture
This worked. PowerCLI C:\Scripts\VMware_Inventory>$owner =@{} PowerCLI C:\Scripts\VMware_Inventory>$owner = get-tagassignment PowerCLI C:\Scripts\VMware_Inventory> $owner Tag             ... See more...
This worked. PowerCLI C:\Scripts\VMware_Inventory>$owner =@{} PowerCLI C:\Scripts\VMware_Inventory>$owner = get-tagassignment PowerCLI C:\Scripts\VMware_Inventory> $owner Tag                                                           Entity ---                                                             ------ Sub_organization_OCIO/CORP               esx1 Sub_organization_OCIO/CORP               esx2 Sub_organization_OCIO/CORP               esx3 PowerCLI C:\Scripts\VMware_Inventory>$owner.GetEnumerator() | ?{ $_.entity.name -eq "esx1" } | Select -Expandproperty tag | Select -ExpandProperty Name CORP
Yes, I created a new Category with Cardinality as single and EntityType as VMhost. Then created few Tags under this tag category and assigned these tags to ESXi hosts respectively, based on their... See more...
Yes, I created a new Category with Cardinality as single and EntityType as VMhost. Then created few Tags under this tag category and assigned these tags to ESXi hosts respectively, based on their ownership. All the hosts in our vcenters has a single tag attached to them. Yes i see them in web client, as well as i can retrieve the tag with get-tagassignment  as well as vmhost -tag. Thanks, VJ
Thanks LucD. Is it possible to get tag information of hosts without slowing down the script?
Hi Guys, I have a script for collecting the necessary information that i need about ESX hosts. The script was very fast, and runs in few minutes to get data from many vCenters. Now i wanted to... See more...
Hi Guys, I have a script for collecting the necessary information that i need about ESX hosts. The script was very fast, and runs in few minutes to get data from many vCenters. Now i wanted to include Tag information of ESX host in my output. This tag is to indicate ownership of the host. I added 'Get-TagAssignment -Entity $_.Name' to my script and hoped it will do the job, But all of a sudden the script became extremely slow, and takes hours to pull just from one VC. We have a mix of 5.5 and 6.0 VCs and hosts. I know that in 5.5, tags have to be retrieved from inventory service., which might be slowing this down. Also i am not able to find a hostsystem property for Tag, that i can include with get-view. I guess this is again due to the fact that it is stored in inventory service and not in vcenter server. Can you please help me here, and find a faster way to get the info. Thanks in advance! $vcenter = vcenter1 connect-viserver $vcenter Get-View -ViewType HostSystem -Property Name,Parent,Runtime.ConnectionState,Config.Product,Hardware,VM -Server $vcenter | %{         $obj = [ordered]@{             vCenter = $vcenter             Hostname = $_.Name             Ownership = Get-TagAssignment -Entity $_.Name             Cluster = &{                 $parent = Get-View -Id $_.Parent -Property Name,Parent                 while($parent -isnot [VMware.Vim.ClusterComputeResource] -and $parent -isnot [VMware.Vim.Datacenter]){                     $parent = Get-View -Id $parent.Parent -Property Name,Parent                 }                 if($parent -is [VMware.Vim.Datacenter]){                     ''                     $script:sa = 'Yes'                 }                 else{                     $parent.Name                     $script:sa = 'No'                 }             }             Stand_Alone = $script:sa             State = $_.runtime.connectionState             ESX_Version =$_.config.product.version             Build =$_.config.product.build             Model =$_.hardware.systemInfo.model             CPU_Sockets =$_.hardware.CpuInfo.numCpuPackages             CPU_Cores =$_.hardware.CpuInfo.numCpuCores             RAM_GB = [math]::Round((($_.hardware.memorySize)/(1GB)),1)             VM = $_.vm.Count         }         $HostReport += New-Object PSObject -Property $obj     } Thanks, VJ
Thanks.
Hello Guys, I am trying to connect to multiple vCenters with different logins that are securely stored in diff .xml files, as shown below. But it seems i cannot use switch statement output for... See more...
Hello Guys, I am trying to connect to multiple vCenters with different logins that are securely stored in diff .xml files, as shown below. But it seems i cannot use switch statement output for credential switch. Please help out. Error: Connect-VIServer : Cannot bind parameter 'Credential'. Cannot convert the "switch" value of type "System.String" to type "System.Management.Automation.PSCredential". Script: $vcenters = get-content "C:\Scripts\VMware_Inventory\vcenters.txt" $cred = Import-Clixml -Path C:\Scripts\VMware_Inventory\cred.xml $cred_SAP = Import-Clixml -Path C:\Scripts\VMware_Inventory\cred_SAP.xml $cred_UNIX = Import-Clixml -Path C:\Scripts\VMware_Inventory\cred_UNIX.xml ForEach ($vcenter in $vcenters) { Connect-VIServer $vcenter -Credential switch ($vcenter) { vcenter1 {$cred} vcenter1 {$cred_SAP} vcenter1 {$cred_UNIX} } } Thanks, VJ
Okay. thanks a lot.
Thanks it works. I am not sure why '$_.config.guestFullName' does not yield the OS though. I tried with and without Get-View, as shown below. It works in my other script (without get-view), but n... See more...
Thanks it works. I am not sure why '$_.config.guestFullName' does not yield the OS though. I tried with and without Get-View, as shown below. It works in my other script (without get-view), but not in this one. @{N="OS";E={$_.config.guestFullName}} @{N="OS";E={Get-View $_.config.guestFullName}}
Hey Guys, I am trying to get OS, CPU, RAM, Disk information of a set of VMs from a text file. But the below script does not give OS. Can you please check it, and tell what can be wrong? Con... See more...
Hey Guys, I am trying to get OS, CPU, RAM, Disk information of a set of VMs from a text file. But the below script does not give OS. Can you please check it, and tell what can be wrong? Connect-VIServer vcenter Get-VM -Name (Get-Content "C:\VMs.txt") | Select Name, @{N="OS";E={Get-View $_.config.guestFullName}}, @{N="CPU";E={$_.numCPU}}, @{N="RAM";E={$_.memoryMB}}, @{N="HardDiskSizeGB";E={(Get-HardDisk -VM $_. | Measure-Object -Sum CapacityGB).Sum}} Thanks, VJ
Thanks a lot LucD. Cool, now Case 3 is working fine on all 10 vCenters. I am still wondering why my previous case 3 script did not work on couple of vCenters only, while it worked spotless on... See more...
Thanks a lot LucD. Cool, now Case 3 is working fine on all 10 vCenters. I am still wondering why my previous case 3 script did not work on couple of vCenters only, while it worked spotless on 8 others.  My apologies with case 2, since i did not want to use 'ConvertFrom-SecureString' and store it in a variable, since some forums say its less secure way. Your approach should be fine on case 2 as well w.r.t to security.
Hello VMware Powercli Experts, I have a requirement to make sure the password for connect-viserver is secured via '-AsSecureString' or 'Get-Credential'. I have listed the below 3 cases. Please... See more...
Hello VMware Powercli Experts, I have a requirement to make sure the password for connect-viserver is secured via '-AsSecureString' or 'Get-Credential'. I have listed the below 3 cases. Please let me know how to resolve this issue. Case 1 is using unsecured password and it works perfectly on all of our vCenters, except for the fact that it is unsecure. Case 2 is using '-AsSecureString', and it fails with all of 10 our vCenters. Case 3 is using 'Get-Credential' and it fails on 2 of our vCenters while it succeeds on rest of the 8 vCenters. Case 1: $Username = Read-Host -Prompt "Please enter your Username:" $Password = Read-Host -Prompt "Please enter your Password:" $vcenter = "vcenter1" Connect-VIServer $vcenter -User $Username -Password $Password Disconnect-VIServer $vcenter -Confirm:$false Output: Name                           Port  User                          ----                           ----  ----                          phx-esxvc-001                  443   corp\vj-a     Case 2: $Username = Read-Host -Prompt "Please enter your Username:" $Password = Read-Host -Prompt "Please enter your Password:" –AsSecureString $vcenter = "vcenter1" Connect-VIServer $vcenter -User $Username -Password $Password Disconnect-VIServer $vcenter -Confirm:$false Output: Connect-VIServer : 3/14/2017 11:28:20 AM    Connect-VIServer        Cannot complete login due to an incorrect user name or password.    At C:\Users\vj\Desktop\Desktop 1\My Scripts\Test\test2.ps1:4 char:1 + Connect-VIServer $vcenter -User $Username -Password $Password + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~     + CategoryInfo          : NotSpecified: (:) [Connect-VIServer], InvalidLogin     + FullyQualifiedErrorId : Client20_ConnectivityServiceImpl_Reconnect_Exception,VMware.VimAutomation.ViCore.Cmdlets.Commands.ConnectVIServer Disconnect-VIServer : 3/14/2017 11:28:20 AM    Disconnect-VIServer        Could not find VIServer with name 'vcenter1'.    At C:\Users\vj\Desktop\Desktop 1\My Scripts\Test\test2.ps1:5 char:1 + Disconnect-VIServer $vcenter -Confirm:$false + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~     + CategoryInfo          : ObjectNotFound: (vcenter1:String) [Disconnect-VIServer], VimException     + FullyQualifiedErrorId : Core_ObnSelector_SelectObjectByNameCore_ObjectNotFound,VMware.VimAutomation.ViCore.Cmdlets.Commands.DisconnectVIServer Disconnect-VIServer : 3/14/2017 11:28:20 AM    Disconnect-VIServer        Could not find any of the servers specified by name.    At C:\Users\vj\Desktop\Desktop 1\My Scripts\Test\test2.ps1:5 char:1 + Disconnect-VIServer $vcenter -Confirm:$false + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~     + CategoryInfo          : ObjectNotFound: (VMware.VimAutom...Server[] Server:RuntimePropertyInfo) [Disconnect-VIServer], ServerObnFailureException     + FullyQualifiedErrorId : Core_ObnSelector_SetNewParameterValue_ServerSpecifiedButNotFound,VMware.VimAutomation.ViCore.Cmdlets.Commands.DisconnectVIServer Case 3: $credential = Get-Credential $Username = $credential.GetNetworkCredential().username $Password = $credential.GetNetworkCredential().password $vcenter = "vcenter1" Connect-VIServer $vcenter -User $Username -Password $Password Disconnect-VIServer $vcenter -Confirm:$false Output: Connect-VIServer : 3/14/2017 11:43:53 AM    Connect-VIServer        Cannot complete login due to an incorrect user name or password.    At C:\Users\vj\Desktop\Desktop 1\My Scripts\Test\test3.ps1:5 char:1 + Connect-VIServer $vcenter -User $Username -Password $Password + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~     + CategoryInfo          : NotSpecified: (:) [Connect-VIServer], InvalidLogin     + FullyQualifiedErrorId : Client20_ConnectivityServiceImpl_Reconnect_Exception,VMware.VimAutomation.ViCore.Cmdlets.Commands.ConnectVIServer Disconnect-VIServer : 3/14/2017 11:43:53 AM    Disconnect-VIServer        Could not find VIServer with name 'vcenter1'.    At C:\Users\vj\Desktop\Desktop 1\My Scripts\Test\test3.ps1:6 char:1 + Disconnect-VIServer $vcenter -Confirm:$false + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~     + CategoryInfo          : ObjectNotFound: (vcenter1:String) [Disconnect-VIServer], VimException     + FullyQualifiedErrorId : Core_ObnSelector_SelectObjectByNameCore_ObjectNotFound,VMware.VimAutomation.ViCore.Cmdlets.Commands.DisconnectVIServer Disconnect-VIServer : 3/14/2017 11:43:53 AM    Disconnect-VIServer        Could not find any of the servers specified by name.    At C:\Users\vj\Desktop\Desktop 1\My Scripts\Test\test3.ps1:6 char:1 + Disconnect-VIServer $vcenter -Confirm:$false + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~     + CategoryInfo          : ObjectNotFound: (VMware.VimAutom...Server[] Server:RuntimePropertyInfo) [Disconnect-VIServer], ServerObnFailureException     + FullyQualifiedErrorId : Core_ObnSelector_SetNewParameterValue_ServerSpecifiedButNotFound,VMware.VimAutomation.ViCore.Cmdlets.Commands.DisconnectVIServer
It works now without any errors. I did not had to change anything.