Jump to content

Recommended Posts

Posted

Hi everyone.

I'm needing some assistance with adding domain users to the local administrator group from the local Administrator account. We currently have a Powershell script that does this and it works just fine, but I have not been able to get this to work in AutoIt. I've tried searching the forums, but have not found a solution that is working.

Here's the code snippet from Powershell:

$domainGroup = [ADSI]("WinNT://domain/user_or_group")
$localGroup = [ADSI]("WinNT://" + $env:COMPUTERNAME + "/Administrators")
$localGroup.PSBase.Invoke("Add",$domainGroup.PSBase.Path)

Can anyone assist with this?

  • Moderators
Posted

Hi, chaoticyeshua. I would do something like this:

$oObj = ObjCreate( "WScript.Shell" )
$Group = ObjGet( "WinNT://" & @ComputerName & "/Administrators,group" )
$Group.Add ( "WinNT://<domain>/<groupname>,group" )

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...