I am trying to implement some simple setup routines uitilizing the context start script (addon-context-windows 5.4.1), like setting up a domain controller on a Windows Server 2016 Core VM.
Therefore I use the following commands:
Install-ADDSForest -DomainName $context[“AD_Domain”] -SafeModeAdministratorPassword:(ConvertTo-SecureString -String $context[“AD_SAFEMODEPASSWORD”] -AsPlainText -Force) -force
Interactively (while I am logged in as Adminstrator) this script works fine. The command [Environment]::Is64BitProcess returns true in this case.
Running these commands in the Start Script I get an “import-module the specified module servermanager was not loaded because no valid module file was found” error. The next cpmmands also throw errors. Searching the internet indicates that this might be a problem because the powershell used by the start script is a 32 bit process. And indeed [Environment]::Is64BitProcess returns false when executed in the start script.
Question: How to fix this, so that I can run the commands mentioned above?
P.S.: For cloud-init I found a similar problem and the solution is to start the script with #ps1_sysnative Maybe there is a similar switch which I have overseen!?