scarboni Posted September 14, 2011 Posted September 14, 2011 (edited) Hello there, I just came across a problem while i was using a simple code contaning run as when im running Active directory. I cant change password on users if i write the following code. If i do a normal run as on the file i can change the password on a ad user but not when im running this code snippet. RunAs($Username, $Domain, $Password, 0, @ComSpec & " /c " & 'dsa.msc', "", @SW_HIDE) Help please Edited September 14, 2011 by scarboni
Akarillon Posted September 14, 2011 Posted September 14, 2011 All managementsoftware in Windows are "immune" to virtual keystrokes etc.. Computer Management Local Group Policy Editor Registry Editor etc etc Challenge accepted!
water Posted September 14, 2011 Posted September 14, 2011 You could use my Active Directory UDF to do what you need (for download please see my signature). My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
scarboni Posted September 14, 2011 Author Posted September 14, 2011 Am I able to run the AD through the CMD by just adding the original run as command and being able to reset passwords? Runas /user:Domain\Username "dsa.msc"
scarboni Posted September 14, 2011 Author Posted September 14, 2011 (edited) You could use my Active Directory UDF to do what you need (for download please see my signature). I read through your UDF a bit, is it able to connect to the Active Directory and search, reset passwords and manage accounts? Im working at a company as a IT dekstop engineer and i created a program named AdminIT which runs AD as the engineers admin account it works to search through the AD but i cannot reset passwords and i suppose i cant create accounts with it either. Edited September 14, 2011 by scarboni
water Posted September 14, 2011 Posted September 14, 2011 (edited) Connect: _AD_Open - you can specify the credentials to use Search: Function _AD_GetObjectsInOU Reset password: Function _AD_SetPassword Manage accounts: Depends on what you want to do Edited September 14, 2011 by water My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
scarboni Posted September 14, 2011 Author Posted September 14, 2011 I would like to get access to this window If im using your UDF i will have to build my own GUI for it right?
water Posted September 14, 2011 Posted September 14, 2011 Yes. If you create your own GUI you can limit the user to the necessary functions. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
scarboni Posted September 15, 2011 Author Posted September 15, 2011 The idea is to get full access to the original AD program, I sure could build my own AD GUI and create most of the functions with your UDF but it would be kinda redundant to invent the wheel once again when all i just want to do is access the program But if it's not possible to use all the functions inside the original AD i probably will have to create my own :S Or I could make a ugly solution where I open the Systemdir and locate dsa.msc and send shift + right mouse button and select run as, check the run as another user and enter the needed information.
scarboni Posted September 15, 2011 Author Posted September 15, 2011 (edited) This code works but its a ugly solution :S $domain = "domain" $username = "user" $password = "password" send("#r") WinWaitActive("Run") ControlSetText("Run", "","[CLASSNN:Edit1]","c:\windows\system32") send("{ENTER}") ControlFocus("system32", "", "SysListView321") sleep(500) Send("dsa.",1) Send("{APPSKEY}") Sleep(100) send("u") winwaitactive("Run as") ControlCommand("", "", "Button3", "Check") Sleep(500) ControlSetText("Run as", "","[CLASSNN:Edit1]",""&$domain&"\"&$username) ControlSetText("Run as", "","[CLASSNN:Edit2]",""&$password) send("{ENTER}") Also found out another solution which worked better. Send("#r") ControlSetText("Run", "", "[CLASSNN:Edit1]", "runas /user:"&$DomainCheck&"\"&$UNCheck&' "mmc %windir%\system32\dsa.msc"') Send("{ENTER}") WinWaitActive(@WindowsDir &"\system32") Send($PWCheck ,1) Send("{ENTER}") Edited September 15, 2011 by scarboni
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