Automation

 View Only
  • 1.  Windows Task Scheduler connect securely

    Posted Mar 09, 2023 03:57 PM

    Is there a (modern) way to connect to vCenter server securly without using files or passwords in clear text, when creating a scheduled task in Windows? Or is there some better way to store and schedule powercli scripts?

    It's been a few years since I did this, and back in the day we used to store the password in a file (http://technodrone.blogspot.com/2012/05/creating-and-storing-powershell.html), but I doubt this is entirely without risk.

    The "modern" way seem to be to use New-VICredentialStoreItem, to store it in but this comes with a pretty big caveat: -Password parameter is "string", so the password is also stored in powershell history which is not ideal. The tests I've done with Get-Credential and SecureString has not worked, but is there a way to not have them in the history in clear text?

    Can't you somehow use the credentials specified when creating the scheduled task?



  • 2.  RE: Windows Task Scheduler connect securely
    Best Answer

    Posted Mar 09, 2023 04:35 PM

    The more secure methods currently are based on the SecretManagement and SecretStore modules.
    Kamen recently wrote a blog post on it, see 
    Managing VICredentials on PowerShell 7 using VMware.VISecret Module!




  • 3.  RE: Windows Task Scheduler connect securely

    Posted Mar 10, 2023 12:41 PM

    Thanks Luc, you're the best as always! This is exactly what I was looking for.