Difference between revisions of "Getting Started (PowerCLI)"

Jump to navigation Jump to search
Updated Syntax Highlighting
(Bit of rewording)
(Updated Syntax Highlighting)
 
(One intermediate revision by the same user not shown)
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">
Line 104: Line 105:
Id              : VirtualMachine-vm-697/4002
Id              : VirtualMachine-vm-697/4002
Name            : Network Adapter 3
Name            : Network Adapter 3
</source>
== Import into PowerShell ==
You can just run PowerCLI by running the shell directly.  In order to be able to use PowerCLI CmdLets in a normal PowerShell session you need to import the module in...
<source lang="powershell">
Add-PSSnapin VMware.VimAutomation.Core
</source>
</source>


== Installed Version ==
== Installed Version ==
To determine the version of PowerCLI currently installed use;
To determine the version of PowerCLI currently installed use;
* <code> Get-PowerCLIversion </code>
 
<source lang="powershell">Get-PowerCLIversion </source>


== Scheduling ==
== Scheduling ==

Navigation menu