I did create a new variable secret one with PSCredentinal.
I did install the Microsoft.PowerShell.SecretManagement module on my server with scope allusers.
I have under Envirument filled in Variable VMWare in the option, I also have choosen to import Microsoft.PowerShell.SecretManagement.
My envirument file has it like this written inside it now:
New-PSUEnvironment -Name “5.1.17763.1432_main” -Path “C:\windows\System32\WindowsPowerShell\v1.0\powershell.exe” -Modules @(‘VMware.PowerCLI’, ‘VMWare.VimAutomation.Core’, ‘ActiveDirectory’, ‘VMware.VimAutomation.HorizonView’, ‘VMware.Hv.Helper’, ‘Microsoft.PowerShell.SecretManagement’) -Variables @(‘VMWare’)
And in my code I do ask for the $vmware variabel but I still get this error:
My code example;
Connect-HVServer -Server $HorizonServer -Credential $VMware
The error I get in UDv3 when I’m trying to use the function:
Cannot validate argument on parameter ‘Credential’. The argument is null or empty. Provide an argument that is not null or empty, and then try the command again
Product: PowerShell Universal
Unless I’m mistaken, currently PSU only supports Version 0.2.1 which is embedded in the product. As far as I know, you do not need to import the module, and importing a newer version could (and very likely would) cause issues like this.
I tried implementing the newer secrets module myself, but it is difficult to say the least. There are limitations with the 0.2.1-alpha release but this is almost certainly where your issue lies.
I did install the module from Powershell and not it works. I’m running 0.9.1 according to the psgallery
Right, what I am saying is that 0.9.1 is not supported in PowerShell Universal. You must use the embedded module (0.2.1-alpha). See here for more information: Implementing SecretManager in UniversalAutomation 1.5.3 - #4 by adam
Call me stupied but it’s working for me aldo I have the 0.9.1 version.
But I guess that could get trubbeling with time how do I reinstall the 0.2.1 version and remove the 0.9.1 version that I have today according to PowerShell running on my PSU server.
You do not have to reinstall 0.2.1, it is embedded in the installation of PowerShell Universal. Simply not importing 0.9.1 in your dashboard code will use 0.2.1. Also, not specifying 0.9.1 in your Import-Module call will almost certainly cause the product to ignore the call because 0.2.1 is already imported into the environment.