VMware Cloud Community
continuum
Immortal
Immortal
Jump to solution

how can I unregister VMs with localcli only ?

Is there a way to unregister VMs when esxcli and vim-cmd no longer work ?

esxcli says cant connect to local host and vim-cmd vmsvc/unregister says 'failed to login'


________________________________________________
Do you need support with a VMFS recovery problem ? - send a message via skype "sanbarrow"
I do not support Workstation 16 at this time ...

0 Kudos
1 Solution

Accepted Solutions
spravtek
Expert
Expert
Jump to solution

Maybe late to the party ... But did you try editing the VM-List manually?

Reference: http://communities.vmware.com/thread/50143

[edit] I know you have limited CLI and all, just trying to think along Smiley Happy

View solution in original post

0 Kudos
7 Replies
jrmunday
Commander
Commander
Jump to solution

Have you tried;

vmware-cmd -s unregister <config_file_path>

-- or is this only a host operation?


C:\Program Files (x86)\VMware\VMware vSphere CLI\bin>vmware-cmd.pl
   Usage: vmware-cmd <options> <vm-cfg-path> <vm-action> <arguments>
          vmware-cmd -s <options> <server-action> <arguments>

     Options:
       Connection Options:
          -H or --server <host>            specifies an ESX host or a vCenter Server
          -h or --vihost <target host>     specifies a target host if host is a virtual center
          -O <port>                        specifies an alternative port
          -Q <protocol>                    specifies an alternative protocol
          -U or --username <username>      specifies a username
          -P or --password <password>      specifies a password
          --sessionfile                    specifies a sessionfile path
          --passthroughauth                specifies a login by sspi option
          --credstore                      specifies to fetch Credential store information
          --encoding                       specifies encoding option
       General Options:
          -h More detailed help.
          -q Quiet. Minimal output
          -v Verbose.

     Server Operations:
       vmware-cmd -l
       vmware-cmd -s register <config_file_path> <datacenter> <resource pool>
       vmware-cmd -s unregister <config_file_path>

     VM Operations:
       vmware-cmd <cfg> getstate
       vmware-cmd <cfg> start <powerop_mode>
       vmware-cmd <cfg> stop <powerop_mode>
       vmware-cmd <cfg> reset <powerop_mode>
       vmware-cmd <cfg> suspend <powerop_mode>
       vmware-cmd <cfg> setguestinfo <variable> <value>
       vmware-cmd <cfg> getguestinfo <variable>
       vmware-cmd <cfg> getproductinfo <prodinfo>
       vmware-cmd <cfg> connectdevice <device_name>
       vmware-cmd <cfg> disconnectdevice <device_name>
       vmware-cmd <cfg> getconfigfile
       vmware-cmd <cfg> getuptime
       vmware-cmd <cfg> answer
       vmware-cmd <cfg> gettoolslastactive
       vmware-cmd <cfg> hassnapshot
       vmware-cmd <cfg> createsnapshot <name> <description> <quiesce> <memory>
       vmware-cmd <cfg> revertsnapshot
       vmware-cmd <cfg> removesnapshots

Synopsis: C:\Program Files (x86)\VMware\VMware vSphere CLI\bin\vmware-cmd.pl OPTIONS


Common VI options:
   --config (variable VI_CONFIG)
      Location of the VI Perl configuration file
   --credstore (variable VI_CREDSTORE)
      Name of the credential store file defaults to <HOME>/.vmware/credstore/vicredentials.xml on Linux and <APPDATA>/VMware/credstore/vicredentials.xml on Windows
   --encoding (variable VI_ENCODING, default 'utf8')
      Encoding: utf8, cp936 (Simplified Chinese), iso-8859-1 (German), shiftjis (Japanese)
   --help
      Display usage information for the script
   --passthroughauth (variable VI_PASSTHROUGHAUTH)
      Attempt to use pass-through authentication
   --passthroughauthpackage (variable VI_PASSTHROUGHAUTHPACKAGE, default 'Negotiate')
      Pass-through authentication negotiation package
   --password (variable VI_PASSWORD)
      Password
   --portnumber (variable VI_PORTNUMBER)
      Port used to connect to server
   --protocol (variable VI_PROTOCOL, default 'https')
      Protocol used to connect to server
   --savesessionfile (variable VI_SAVESESSIONFILE)
      File to save session ID/cookie to utilize
   --server (variable VI_SERVER, default 'localhost')
      VI server to connect to. Required if url is not present
   --servicepath (variable VI_SERVICEPATH, default '/sdk/webService')
      Service path used to connect to server
   --sessionfile (variable VI_SESSIONFILE)
      File containing session ID/cookie to utilize
   --url (variable VI_URL)
      VI SDK URL to connect to. Required if server is not present
   --username (variable VI_USERNAME)
      Username
   --verbose (variable VI_VERBOSE)
      Display additional debugging information
   --version
      Display version information for the script

vExpert 2014 - 2022 | VCP6-DCV | http://www.jonmunday.net | @JonMunday77
continuum
Immortal
Immortal
Jump to solution

I dont have have vmware-cmd on esxi5

I am quite happy that I can still login via ssh - all other remote control options are dead


________________________________________________
Do you need support with a VMFS recovery problem ? - send a message via skype "sanbarrow"
I do not support Workstation 16 at this time ...

0 Kudos
jrmunday
Commander
Commander
Jump to solution

It's a perl script - part of the vSphere CLI so you won't be able to use it from the DCUI. I thought if you can SSH, then this might still work as a last resort if all the local CLI commands are Not working?

vExpert 2014 - 2022 | VCP6-DCV | http://www.jonmunday.net | @JonMunday77
0 Kudos
continuum
Immortal
Immortal
Jump to solution

Hi
sorry - when I saw vmware-cmd I assumed you meant that tool which was available at the local console of earlier ESXi versions.

I just made a check and as expected I can not connect - neither with vmware/cmd.pl nor with esxcli.exe

It says Server version unavailable at https:// ...

I would have been very surprised if that still worked with a half dead hostd


________________________________________________
Do you need support with a VMFS recovery problem ? - send a message via skype "sanbarrow"
I do not support Workstation 16 at this time ...

0 Kudos
spravtek
Expert
Expert
Jump to solution

Maybe late to the party ... But did you try editing the VM-List manually?

Reference: http://communities.vmware.com/thread/50143

[edit] I know you have limited CLI and all, just trying to think along Smiley Happy

0 Kudos
continuum
Immortal
Immortal
Jump to solution

> just trying to think along ....

and dead on target http://sanbarrow.com/gifs/thumbup.gif

Seems to be exactly what I need - the path has changed - nowadays it is /etc/vmware/hostd/vmInventory.xml
Editing is easy if I use the buildin editor of winscp - so no worries to mess up the xml.

For tests - edit the xml and run services.sh restart on a healthy host.
You can even register VMs that way.

Now I still have to worry if that dying system can still write back its config .... and what happens in the vCenter ...

Anyway - thanks again


________________________________________________
Do you need support with a VMFS recovery problem ? - send a message via skype "sanbarrow"
I do not support Workstation 16 at this time ...

0 Kudos
spravtek
Expert
Expert
Jump to solution

Super! ... Glad you got it solved ... And thanks for letting us know the path changed for the inventory file.

0 Kudos