I have a strange error with the PowerShell and a simple command:
New-LocalGroup -Description "Test Usergroup" -Name Testsusers
When I open the Powershell from CMD-box or from Start menu and run the command everything works fine (if I start with elevated rights). If I start the Shell without elevated rights I get the correct message "access denied...".
I want to run this command from an installation script (Inno Setup). The setup runs with elevated privileges, the powershell starts, but the script will not be executed. I have added to the command line the parameter "-NoExit" so that I can see what is happening. So I see that the command "New-LocalGroup" is unknown (CommandNotFoundException).
How can it be that on the same Windows 10 X64, with the same user the command is once known and once not?