Welcome to ISUPPORTYOU.NET

    Enter your email address:

    feedburner

    Delivered to your INBOX

    I hope this blog is useful to all of you. Please send your ideas and queries to charan@isupportyou.net
    Regards
    Narayana Charan.B
    VCP4, MCSE, SCSA

Translate this page

CitrixXD (2) Hardware (6) HyperV (2) Jobs / Walkins (7) Latest (17) Tech News (5) Videos (31) VMWare (43) VMwareVDI (2) Windows (26)

vSphere PowerCLI : Part - II

image Now that you guys have installed PowerCLI and you have got an idea how to start use PowerCLI, today we would look at some PowerCLI commands which would be use full in day-to-day administration.

To connect to your ESX/I or VC system use the below command:
PS> Connect-VIServer <IP for ESX/I or VC> or <DNSNAME for ESX/I or VC>
EG --> Connect-VIServer 192.168.0.1
EG --> Connect-VIServer esx01
EG --> Connect-VIServer VC01

Once this is enter, a window will pop up for login credentials. If you are connecting to your ESX or ESXi system authenticate with root user. If you are connecting to your VC authenticate with the user which has admin access to the VC.

Now that you are able to connect the your host / VC using PowerCLI, lets have a look at some useful commands for the ESX adminstration..

To list all the VMware Infrastructure Servers (VMHost) on the connected VI Server
Get-VMHost

Get all Hosts member of a Cluster
Get-Cluster Cluster01 | Get-VmHost

To add a new VMHost to inventory (requires connection to vCenter)
Add-VMHost ESX01 -Location (Get-Datacenter Main) -User root -Password MyPass

To remove a VMHost
Get-VMHost ESX01 | Remove-VmHost

To move a VMHost
Move-VMHost (Get-VMHost ESX01 ) -Destination (Get-Datacenter MyDatacenter)

To change the state of a VMHost
# Disconnect Host
Set-VmHost -VmHost ESX01 -State ”Disconnected“
# Enter Host in maintenance mode
Set-VmHost -VmHost (Get-VmHost -Name ”ESX01”) -State ”Maintenance“
#Connect Host or Exit Maintenance
Set-VmHost -VmHost (Get-VmHost -Name ”ESX01”) -State ”Connected“

ESX Host Accounts (requires direct ESX Host connection)
Get-VMHostAccount -user
New-VMHostAccount -ID user -Password password -UserAccount
New-VMHostAccount -Id normalusers -GroupAccount -AssignUsers user
Get-VMHostAccount - Group -ID user | Remove-VMHostAccount -Confirm

Service Configuration (requires direct ESX connection)
Get-VMHostService -Refresh
Get-VmHostService -VMHost 192.168.1.10 | ?{$_.key -eq ”vmware-vpxa“} |Restart-VMHostService

NTP Server settings
Get-VMHostNtpServer ESX01
Add-VmHostNtpServer -NtpServer ”
pool.ntp.org

“ -VMHost (Get-VMHost ESX01 )

Previous                                                                                                                     Continued....

____________________________________________________________________________

imageThis article has been posted by Mr.Amit. He was acting as co-author for this blog. He is a VMware Certified Professional, and working as VMware and Linux Admin. He has a very good exposure in the command line level of UNIX & VMware.

if you have any queries you can contact him at amit@isupportyou.net 

Related Posts

1 comments:

  1. Thanks to published this....

    If it possible to get the ESX host NIC information through vSphere PowerCLi.........

    ReplyDelete

Please add your comment, if you like this article.