VMware Cloud Community

Running a PowerCLI Script Non-Interactively


I am trying to write a PowerShell script using PowerCLI modules that retrieves the following data automatically, writes them to registry keys, and launches a program that reads the data from the registry keys:

  • List of VM Hosts
  • List of Datastores
  • List of Virtual Networks
  • List of VM Templates

This script is not meant to be run interactively, and due to compliance reasons, I am not allowed to use the VICredentialStore. I am also not allowed to store credentials in a password-key file.

I currently have the script working interactively, where it requests the user for credentials upon execution. How do I convert the script, mainly the Connect-VIServer part, to run non-interactively with the restrictions above?

A quick Google search suggested using a group managed service account (gMSA), but PowerCLI (and vSphere) does not seem to support this. Are there plans to add support for gMSA in the future?


PowerShell and PowerCLI details:

  • PSVersion: 5.1.14393.5066
  • PowerCLI Version: VMware PowerCLI 12.0.0 build 15947286
Tags (2)
0 Kudos
1 Reply

Since this looks like a feature request, I would suggest creating an "Idea" on VMware PowerCLI (aha.io)

Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos