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
Answers (1)
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