'Add-LocalGroupMember' is not recognized... RRS feed

  • General discussion

  • Windows 10 1709 client is running a script that looks up who the computer belongs to in a database and then adds that person as the local administrator using the Add-LocalGroupMember cmdlet.

    The script is working fine embedded in our image and launched from setupcomplete.cmd and run as Local System. However, when I wrap the same .ps1 in a .bat shell script and set it in to run as Local System in Dell/Quest KACE the script errors saying that the Add-LocalGroupMember cmdlet is not recognized. If I launch an interactive PS session as Local System and run it, it runs fine.

    I added "Get-Module -ListAvailable" to the script and turned on transcription to log everything and the Microsoft.PowerShell.LocalAccounts module is noticeably missing, but only when this script is instantiated via a KACE script, and the KACE script is really just a simple .bat which runs the .ps1: "powershell C:\ProgramData\Dell\KACE\kbots_cache\packages\kbots\886\addadminRunNow.ps1" I've tried a literal path to both x64 and x86 powershell executables and that has had no effect.

    I ran the script from an interactive PS session running as Local System and, again, it ran find, and listed the module as available.

    Does anyone have any idea what is going on?

    • Changed type Bill_Stewart Tuesday, May 8, 2018 6:23 PM
    • Moved by Bill_Stewart Tuesday, May 8, 2018 6:23 PM This is not a support forum for third-party software
    Thursday, March 8, 2018 4:20 PM

All replies

  • That's a Dell/KACE support question, not a general scripting question. (This forum can help if you have errors in your script.)

    -- Bill Stewart [Bill_Stewart]

    Thursday, March 8, 2018 4:50 PM
  • The module is only available on Windows 10 and later.  It cannot be run from a remote management system.  Ask Dell for a fix.


    • Edited by jrv Thursday, March 8, 2018 10:10 PM
    Thursday, March 8, 2018 10:09 PM