WilliamLam.com

  • About
    • About
    • Privacy
  • VMware Cloud Foundation
  • VKS
  • Homelab
    • Resources
    • Nested Virtualization
  • VMware Nostalgia
  • Apple
You are here: Home / Automation / 'System.Management.Automation.ConfigPropertyAccessor' exception when launching PowerCLI Core in Linux firstboot script

'System.Management.Automation.ConfigPropertyAccessor' exception when launching PowerCLI Core in Linux firstboot script

01.03.2017 by William Lam // Leave a Comment

Happy New Years everyone!

I just got back into the swing of things after taking some much needed time off over the holiday break. While catching up on my email, I also re-visited one of my pet projects I had been working on right before the break. I needed to launch a specific PowerCLI script upon firstboot from a Linux system, specifically PhotonOS leveraging PowerCLICore. My first few attempts had failed and in troubleshooting the issue further, I found the following cryptic error message in the system logs:

The shell cannot be started. A failure occurred during initialization:
The type initializer for 'System.Management.Automation.ConfigPropertyAccessor' threw an exception.

After a bit of Googling, I found the following Github PR which seems to indicate that the HOME environmental variable may not properly configured or readable by Powershell. The quick fix was to simply define the HOME directory within the shell script that starts up the PowerCLI script.

Below is a snippet of what I needed to add to /etc/rc.d/rc.local to automatically run my PowerCLI script:

export HOME=/root

/usr/bin/powershell -File /root/MyPowerCLI-Script.ps1

The following command was also useful in troubleshooting and verifying that my PowerCLI script had properly executed since there was no output in my script log:

journalctl --no-pager | grep rc.local

More from my site

  • VMware PowerCLI for Mac OS X, Linux & More? Yes, please!
  • Packer reference for building PhotonOS Virtual Appliance using OVF properties 
  • Building your own Virtual Appliances using OVF properties Part 2
  • How to install PowerCLI Core on Debian Linux?
  • Cluster API BYOH Provider on Photon OS (Arm) with Tanzu Community Edition (TCE) and ESXi-Arm

Categories // Automation, PowerCLI Tags // linux, Photon, PowerCLICore

Thanks for the comment!Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Search

Thank Author

Author

William is Distinguished Platform Engineering Architect in the VMware Cloud Foundation (VCF) Division at Broadcom. His primary focus is helping customers and partners build, run and operate a modern Private Cloud using the VMware Cloud Foundation (VCF) platform.

Connect

  • Bluesky
  • Email
  • GitHub
  • LinkedIn
  • Mastodon
  • Reddit
  • RSS
  • Twitter
  • Vimeo

Recent

  • Programmatically accessing the Broadcom Compatibility Guide (BCG) 05/06/2025
  • Quick Tip - Validating Broadcom Download Token  05/01/2025
  • Supported chipsets for the USB Network Native Driver for ESXi Fling 04/23/2025
  • vCenter Identity Federation with Authelia 04/16/2025
  • vCenter Server Identity Federation with Kanidm 04/10/2025

Advertisment

Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
To find out more, including how to control cookies, see here: Cookie Policy

Copyright WilliamLam.com © 2025