Jump to content

Recommended Posts

Posted

Hey the community,

I'm trying to run GPMC from a local user (on a domain machine) As domain admin user.  First, I wanted to find the right command runas from CMD.
With a "runas /netonly /user:Domain\user "mmc gpmc.msc" " I got "To manage Group Policy, you must log on to the computer with a domain user account"

Finally, I found a kind of workaround with runas a cmd : runas /user:DOMAIN\user "cmd /c Start /B gpmc.msc"

Is there a way to not run a specific cmd ? And if it is the only way, I do not find the corresponding Global Const $CLIENT_EXECUTABLE, I try some like 'mmc "cmd /c Start /B <Path/to/gpmc.msc"'

Maybe someone already tried to runas gpmc with AutoIt.

Thanks in advance,

TLAM

 

Posted

$Username = "toto"

$Domain = "contoso.com"

$Password = "mypassword"

RunAs ( "$Username", "$Domain", "$Password", $RUN_LOGON_PROFIL , "c:\Myprogramme.exe"  )

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Posted

Use @ComSpec and mmc.exe to call the msc file.  Example below.  

#include <AutoItConstants.au3>

Global $sUserName = "User"
Global $sDomain = "AD"
Global $sPassword = "Password"

RunAs($sUserName, $sDomain, $sPassword, $RUN_LOGON_NOPROFILE, @ComSpec & " /c mmc.exe gpmc.msc", @ScriptDir, @SW_HIDE)
If @error Then ConsoleWrite('! ---> @error=' & @error & '  @extended=' & @extended & ' : RunAs Error' & @CRLF)

 

Adam

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...