From 8a4abe7dd4c71d8997591455d87f300ff04a736e Mon Sep 17 00:00:00 2001 From: alanrenouf Date: Wed, 31 Jan 2018 22:18:58 -0800 Subject: [PATCH] Added a VMC example script --- Scripts/VMC Example Script.ps1 | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100755 Scripts/VMC Example Script.ps1 diff --git a/Scripts/VMC Example Script.ps1 b/Scripts/VMC Example Script.ps1 new file mode 100755 index 0000000..d1f1fae --- /dev/null +++ b/Scripts/VMC Example Script.ps1 @@ -0,0 +1,34 @@ +#List the commands available for the VMC module +Get-VMCCommand + +#Connect to VMC +$MyRefreshToken = "XXXX-XXXX-XXXX-XXXX" +Connect-VMC -RefreshToken $MyRefreshToken + +#List the Orgs available to us +Get-VMCOrg + +#List the SDDCs +Get-VMCSDDC -Org BashFest* + +#List the Tasks for a particular Org +Get-VMCTask -Org BashFest* | Select-Object task_type, Sub_Status, start_time, End_time, user_name | Sort-Object Start_Time | Format-Table + +#Get the Public IPs for a SDDC +Get-VMCSDDCPublicIPPool -org bashfest* + +#Get all ESXi hosts for given SDDC +Get-VMCVMHost -org bashfest* -Sddc virtu-al + +#Get the credentials of a SDDC so we can login via vSphere cmdlets +Get-VMCSDDCDefaultCredential -org bashfest* -Sddc virtu-al + +#Connect to your VMC vCenter with default creds +Connect-VmcVIServer -org bashfest* -Sddc virtu-al + +#Run some vSphere cmdlets + +#List all VMs from On-Premises and VMC SDDC +Get-VM | Select vCenterServer, Name, PowerState, VMHost + +