[ BASICS.VMWARE ]

[ BASICS.VMWARE ]
# Lists descriptions of device commands.
esxcli device
# Lists descriptions for commands that manage Emulex elxnet drivers.
esxcli elxnet
# Lists descriptions of esxcli commands.
esxcli esxcli
# FCOE (Fibre Channel over Ethernet) commands
esxcli fcoe
# Graphics commands
esxcli graphics
# Hardware namespace. Used primarily for extracting information about the current system setup.
esxcli hardware
# iSCSI namespace for monitoring and managing hardware and software iSCSI.
esxcli iscsi
# Network namespace for managing virtual networking including virtual switches and VMkernel network interfaces.
esxcli network
# Commands for managing NVMe devices.
esxcli nvme
# Commands for monitoring RDMA devices.
esxcli rdma
# Manage the shared system-wide swap space.
esxcli sched
# Software namespace. Includes commands for managing and installing image profiles and VIBs.
esxcli software
# Includes core storage commands and other storage management commands.
esxcli storage
# System monitoring and management command.
esxcli system
# Namespace for listing virtual machines and shutting them down forcefully.
esxcli vm
# Namespace for Virtual SAN management commands. 
esxcli vsan

Testing Boundary value analysis
Testing Equivalence Class Partitioning
======================================================

POWERCLI BUILD VERSION
run Get-PowerCLIVersion 

VMWARE COMMANDS
get-command | where {$_.Source -like 'VMware*'}

FILTER OUT NON-VMWARE RELATED CMDLETS
{$_.Source -like ‘VMware*’} 

LIST VMWARE CMDLETS THAT CONTAIN 'DATASTORE’
get-command -Type cmdlet -name '*datastore*'

SPECIFIC POWERCLI COMMAND
Get-Help PowerShell cmdlet
Get-Help Connect-VIServer

Example 2 – Display the online help page for the cmdlet Disconnect-VIServer.

Get-Help Connect-VIServer -Online

Example 3 – List usage examples for a specific command.

Get-Help Get-VM -Examples


establish a connection to either an ESXi host or a vCenter Server.


Connect to ESXi host using integrated authentication
Connect-VIServer 192.168.10.1

# Connect to ESXi host using credentials passed on from the command line.
Connect-VIServer 192.168.16.113 -User root -Password Notapassword

# Connect to a host or vCenter Server using -menu parameter to 
# select an entry from a history list of previously established connections
Connect-VIServer -menu

Figure 4 - Connecting to a previously connected to ESXi host or vCenter Server
Figure 4 – Connecting to a previously connected to ESXi host or vCenter Server



How do I retrieve a list of connections currently in use?
There’s a variable called DefaultVIServers which keeps a list of connections established during a current session. We can display the contents by simply calling the variable as follows;

$DefaultVIServers

Display currently established ESXi or vCenter Server connections
Display the list of currently established ESXi or vCenter Server connections

# disconnect from an ESXi host or vCenter Server
Disconnect-VIServer

# Drop all established connections
Disconnect-VIServer -Server * -Force

# Drop a specific connection using the $DefaultVIServers variable. 
# Note that the variable in reality is an array, 
# with [0] represents first entry [1] the second
# parameter to suppress confirmation.
-Confirm:$false
Disconnect-VIServer -Server $DefaultVIServer[0] -Confirm:$false

$ Drop connection by IP address / ESXi hostname / vCenter Server.
Disconnect-VIServer -Server vcsa-2.vsphere.local -Confirm:$false

# Vms on ESXi host / 192.168.16.113
Get-VM -server 192.168.16.113

# display VM name and running state. 
# Connected to multiple hosts for the combined list of vms

Get-VM | ft -Property Name,PowerState


Example 3 – List only those vms that are currently powered on.
Get-VM | where {$_.PowerState -eq 'PoweredOn'}
1
Get-VM | where {$_.PowerState -eq 'PoweredOn'}
Example 4 – List only those vms that are running a Windows guest OS.

get-vm | where {$_.Guest.OSFullName -like '*Windows*'}
1
get-vm | where {$_.Guest.OSFullName -like '*Windows*'}









































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































No comments:

Post a Comment

Blog Archive