/build/static/layout/Breadcrumb_cap_w.png

How deploy a script to add "domain users" in local group ?

Hi,

I would like to deploy a script to add "domain users" group in local group.
I tried everything to deploy.

It's working in local but not with Kace, i don't know why.

I tried also to disable UAC
I tried "run as" with
-system local
-domain admin

Here are my scripts :

Batch:
net localgroup "group" /add
net localgroup "group" "domain\domain users" /add


Powershell:
New-LocalGroup -Name "group"
$DomainGroup = "domain users"
$LocalGroup  = "group"
$Computer    = $env:computername
$Domain      = $env:userdomain
([ADSI]"WinNT://$Computer/$LocalGroup,group").psbase.Invoke("Add",([ADSI]"WinNT://$Domain/$DomainGroup").path)


Maybe someone get the answer

Thank you


0 Comments   [ + ] Show comments

Answers (1)

Posted by: JasonEgg 3 years ago
Red Belt
0

Works for me in scripting. I upload the ps1 file as a dependency to the script and then use "Launch a program..." with these settings:

Directory:  $(KACE_SYS_DIR)\WindowsPowerShell\v1.0

File: powershell.exe

Parameters:  -nologo -executionpolicy bypass -WindowStyle hidden -file $(KACE_DEPENDENCY_DIR)\add-user-to-group.ps1

 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ