Kaseya Community

Execute Shell Command problems

  • The following command works as intended ("DOMAIN\Domain Users" is added to the local Administrators group) when executed from a command prompt. When I use it in a Execute Shell Command step in a script, it indicates success but the Domain Users group is not added. It has the same results whether I use a credential or not, or if I run it as System. Any ideas?

    Here's the command:
    for /f "tokens=4" %g in ('C:\SequoyaITSentry\browstat status ^| find "Status for domain"') do net localgroup /add Administrators "%g\Domain Users"

    Legacy Forum Name: Execute Shell Command problems,
    Legacy Posted By Username: sequoya
  • Are you running as user or system? also you may want to try the impersonate user option

    Legacy Forum Name: Scripts Forum,
    Legacy Posted By Username: thirteentwenty
  • thirteentwenty
    Are you running as user or system? also you may want to try the impersonate user option


    I mentioned in the OP that running as user or system didn't matter. I tried impersonation, but that should have the same effect as Use Credential - neither one worked.

    Legacy Forum Name: Scripts Forum,
    Legacy Posted By Username: sequoya
  • I wonder if the .exes are screwing this up. I can do a simple 'echo foo > file.txt' and it works.

    Legacy Forum Name: Scripts Forum,
    Legacy Posted By Username: sequoya