Showing posts with label vCenter. Show all posts
Showing posts with label vCenter. Show all posts

Saturday, May 1, 2021

Saturday, February 27, 2021

vCenter (vCSA) console commands

List of useful vCenter console commands
 
Services:

service-control --list-services
service-control --status
service-control --status vpxd
service-control --stop vpxd
service-control --start vpxd
service-control --stop --all
service-control --start --all

Monday, February 15, 2021

Resetting root password in vCenter Server Appliance 6.5 to 6.7 U1

This post provides steps to reset a lost, forgotten, or expired root password for a vCenter Server Appliance (or external PSC) 6.5 and later.
 
Important: This article is explicitly for the vCenter Server Appliance (and external PSC 6.5 and 6.7) 6.5 and later.

  1. Take a snapshot or backup of the vCenter Server Appliance before proceeding.

    Caution: DO NOT SKIP THIS STEP

    Note: If the vCenter Appliance is on the same ESXi hosts it manages. Connect directly to the ESXi host that it is located on to perform these steps.

  2. Reboot the vCenter Server Appliance.
  3. After the VCSA Photon OS starts, press the e key to enter the GNU GRUB Edit Menu.


  4. Locate the line that begins with the word Linux.


  5. Append these entries to the end of the line:

    rw init=/bin/bash


  6. Press F10 to continue booting.
  7. Run the command

    mount -o remount,rw /
      
  8. In the Command prompt, enter the command passwd and provide a new root password (twice for confirmation):

    passwd

  9. Unmount the filesystem by running this command (yes, the unmount command is umount  -  it's not a spelling error):

    umount /

  10. Reboot the vCenter Server Appliance by running this command:

    reboot -f

  11. Confirm that you can access the vCenter Server Appliance using the new root password.
  12. Remove the snapshot taken in Step 1 if applicable.
  13. You could set the Root password to never expire in order to prevent this issue by running command:

    # chage -I -1 -m 0 -M 99999 -E -1 root  or at the VAMI  ( https://<vcenter_fqdn>:5480)

Wednesday, April 11, 2018

How to remove orphaned Horizon View VMs

Save the commands outlined in red into a .ps1 script file. 

Run the script using PowerCLI from the vCenter server. In case of an appliance, run it from any machine that has PowerCLI installed.

$vcserver = "vcenter.domain.com"
$vcusername = "vcenter_admin"
$vcpassword = "password"

Connect-VIServer -Server $vcserver -User $vcusername -Password $vcpassword

$allVMs=Get-VM
foreach ($vm in $allVMs) { if ($vm.ExtensionData.Runtime.ConnectionState -eq "orphaned") {$vm | Remove-VM}
}

If you get an error about the Remove-VM method being disabled by horizon.daas, you will first need to unprotect folders in vCenter. To do that run the following command using PowerCLI on the Horizon Connection Broker.

IcUnprotect.cmd -vc hostname_or_IP_address -uid user_ID -password password [-clusterId cluster_ID] [-includeFolders]

Once folders have been unprotected, re-run the original script.

Monday, January 27, 2014

vSphere 5.x Storage vMotion does not rename virtual machine files on completing migration

This has been resolved in vCenter 5.0 Update 2 as well as 5.1 Update 1.

To fully resolve this issue after updating the vCenter Server, add the provisioning.relocate.enableRename advanced parameter to vCenter Server and set its value to true:

  1. Log into the vSphere Client as an Administrator.
  2. Click Administration > vCenter Server Settings.
  3. Click Advanced Settings.
  4. Add this advanced parameter Key: provisioning.relocate.enableRename
  5. Set the value to: true
  6. Click OK.
  7. Restart the VMware VirtualCenter Server service for the changes to take effect.