Below is the script I am using to try and add a domain user to the local administrator group on about fifty workstations. Unfortunately since the local user is the only one in the local admin group I do not "technically" have permission to add a domain user. This script works when run locally but I want to run it in a loop to all fifty machines over the network. Is there a way to embed a username and password into the script? Thanks.
'this is domain group name in general, adminstrators in particular
sdomgrp= Chr(34)& "cuzone\local admin machine" & Chr(34) '<<<input domain group name
sdomgrp= """cuzone\local admin users"""
'these 2 variables varying host to host
slocgrp="administrators" '<<<input local group name
slochost="mis133" '<<<input local machine name
scmd="net localgroup " & slocgrp & " " & sdomgrp & " /add"
set svcproc=getobject("winmgmts:\\" & slochost & "\root\cimv2:win32_process")
iret=svcproc.create(scmd,nul,nul,pid)
if iret=0 then
wscript.echo "net localgroup successfully launched on " & slochost
else
wscript.echo "net localgroup failed to launched on " & slochost
end if
set svcproc=nothing
'this is domain group name in general, adminstrators in particular
sdomgrp= Chr(34)& "cuzone\local admin machine" & Chr(34) '<<<input domain group name
sdomgrp= """cuzone\local admin users"""
'these 2 variables varying host to host
slocgrp="administrators" '<<<input local group name
slochost="mis133" '<<<input local machine name
scmd="net localgroup " & slocgrp & " " & sdomgrp & " /add"
set svcproc=getobject("winmgmts:\\" & slochost & "\root\cimv2:win32_process")
iret=svcproc.create(scmd,nul,nul,pid)
if iret=0 then
wscript.echo "net localgroup successfully launched on " & slochost
else
wscript.echo "net localgroup failed to launched on " & slochost
end if
set svcproc=nothing