Difference between revisions of "Getting Started (PowerCLI)"

Jump to navigation Jump to search
Updated Syntax Highlighting
(Added "Import into PowerShell ")
(Updated Syntax Highlighting)
 
Line 19: Line 19:
<source lang="powershell"> Connect-VIServer -Server <server> -User <user> -Password <pass> </source>
<source lang="powershell"> Connect-VIServer -Server <server> -User <user> -Password <pass> </source>


Once connected you can do real work with the PowerCLI, to see what's available, login to https://server/mob.  This is effectively where you end up once you've completed the <code> Connect-VIServer </code> command.
Once connected you can do real work with the PowerCLI, to see what's available, login to https://server/mob.  This is effectively where you end up once you've completed the <syntaxhighlight lang="powershell" inline> Connect-VIServer </syntaxhighlight> command.


Try some of the following...
Try some of the following...
Line 25: Line 25:
Get-Cluster
Get-Cluster
Get-VMHost
Get-VMHost
Get-VM </source>
Get-VM  
</source>


Be aware that PowerShell commands generally return objects, rather than simple variables containing text or numbers.  So the textual representation of the return object is often abbreviated for simplicity.  To see the entire return for a command, pipe the result into <code>Format-List</code>.  To complicate matters further, some return objects contain further objects, see examples below
Be aware that PowerShell commands generally return objects, rather than simple variables containing text or numbers.  So the textual representation of the return object is often abbreviated for simplicity.  To see the entire return for a command, pipe the result into <syntaxhighlight lang="powershell" inline>Format-List</syntaxhighlight>.  To complicate matters further, some return objects contain further objects, see examples below


<source lang="powershell">
<source lang="powershell">

Navigation menu