Jump to content

Net Local group with Space Name Psexec


 Share

Recommended Posts

Hi everyone, 

Hope you are doing fine by the time being :/

Well, seems that I'm running into an issue while trying to add an Active domain security group to a remote computer that has a space in it.
I've been searching for quite a while now and seems that my search did not get well. 

The ideal solution for me would be to use Psexec.exe as I can run it with my admin credentials whereas using WMIServices, I don't know how to launch that with these credentials.

Here's what I wrote so far:

$sADGroupName as a space in it and there's nothing I can do about, we have to respect a naming convention but it would be "Admins REMOTEMACHINENAME"

Func f_AddADGroup2localAdmin()
    SplashTextOn("", "Adding " & $sADGroupName & " to the Local Administrators Group.", 1000, 100, -1, -1,  33, -1, -1, 700)
    $sCommand = $sResources & 'PsExec -accepteula \\' & $sServName & ' net localgroup Administrators MYDOMAIN\"' & $sADGroupName & '" /add'
    RunAsWait($sTechGID, "MYDOMAIN", $sTechPWD, 4, $sCommand, @SW_SHOW)
    SplashOff()
    ; f_MoveADObject()
End Func

What is weird is when I output the $sCommand variable, the space is in here but it seems not to be passed in my psexec command when I run it.

Another thing I saw is that 4 times out of 10, psexec does not even launch.

So I was also wondering if there could be another way to add the "spaced" group with my admin credentials on a remote server other than psexec.

Thanks all in advance for the lights you may provide to me and keep safe!

-31290-

 

 

 

 

~~~ Doom Shall Never Die, Only The Players ~~~

Link to comment
Share on other sites

My goodness, you were right... That was the thing. 

I probably stayed too much looking at this line and to be honest, I'm not the best at this :)

Thank you Sir. Please keep safe! 

~~~ Doom Shall Never Die, Only The Players ~~~

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...