Hello,
Maybe you try the old way with [ADSI] object :
https://devblogs.microsoft.com/scripting/adding-local-users-to-local-groups/
Regards,
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
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?
Hello,
Maybe you try the old way with [ADSI] object :
https://devblogs.microsoft.com/scripting/adding-local-users-to-local-groups/
Regards,
Hi @Eddie Eagle ,
you could give it a try to load the PS module in your script first: Import-Module localaccount
----------
(If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)
Regards
Andreas Baumgarten
When I try this I get the following message:
Import modules : The specified module "localaccount" was not loaded because no valid module file was found in any module directory.
Best,
Thomas
No, I start it as "normal" admin, with elevated rights.
Thomas
This gives exact the same error.