TLAM Posted September 4, 2018 Posted September 4, 2018 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
caramen Posted September 4, 2018 Posted September 4, 2018 $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 - WikiOutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsPowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & SupportExcel - Example Scripts - WikiWord - Wiki Tutorials:ADO - Wiki
TLAM Posted September 6, 2018 Author Posted September 6, 2018 Thanks to remind me the documentation, My problem is more specific, about gpmc.msc..
AdamUL Posted September 6, 2018 Posted September 6, 2018 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
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now