Using The Windows Photon Controller CLI For The First Time

vmware-photon-controllerWhen managing VMware’s Photon Controller, you can either manage it via the new management UI or via the CLI. Personally, I am a ‘mouse’ type of guy so I often prefer to use the UI’s were possible. However, occasionally we have to use CLI’s from time to time. When I tried to download and install the Windows Photon Controller CLI (A.K.A. Photon Command-Line Utility) for the first time, it wasn’t as obvious as it probably should have been. Doing a quick Google, didn’t return anything useful. So I thought I’d create a quick post detailing how to use the Windows Photon Controller CLI to connect to your Photon Controllers.

  • Download the Windows Photon Controller CLI 
    • Make sure you download the correct version based on the version of Photon Controller you installed. So if you installed Photon Controller 1.0.0, download the CLI from that section.
    • Once you’ve downloaded the file, do not attempt to install it. It’s not designed to be installed.
  • Place the .exe file somewhere that you will easily remember. For me it was just simply C:\photon. It might also be worth renaming the .exe to photon.exe if it isn’t already, just for simplicity.
  • Open up your favorite Windows Command-Line utility. This could be CMD. I use Powershell as I find it a little more user-friendly than the native Windows CMD (although Window10 version is a lot nicer).
  • Navigate to the location where you placed the photon.exe.

 

C:\Users\Simon> cd c:\photon
C:\photon> dir

       Directory C:\photon

Mode           LastWriteTime     Length  Name
-----          -------------     ------  ----
-a---     11/30/2016 4:06 PM   11618304  photon.exe

C:\photon>
  • Next you’ll need to run the following command to connect to your Photon Controller

 

C:\photon> .\photon.exe target set http://[PhotonControllerURL] -c
API target set to 'http://[PhotonControllerURL]
C:\photon>
  • Now enter the username and password used to authenticate to your Photon Controller

 

C:\photon> .\photon.exe target login -u admin@MYDOMAIN -p MYPASSWORD 
Token stored in config file
C:\photon>

You are now connected to your Photon Controller! You can run all of the Photon CLI commands that are available. Try the following to show more information about your Photon deployment

C:\photon> .\photon.exe deployment list

I hope this helps someone 🙂