Sign in to follow this  
Followers 0
tweakster2010

Odd Issue with MMC

5 posts in this topic

To anyone who has played with MMC on a basic level(I am still learning so going over the top might take me a minute to figure out).

The script I have setup runs elevated with administrator ID and a regular ID which is how my job is setup. Now when I trigger anything with MMC it has a tissy over it unless I manually access MMC first.

AKA 

$iPID = RunAs(GuiCtrlRead($Username), "domain", GuiCtrlRead($Pass), 0, "mmc C:\Windows\system32\printmanagement.msc")

Now when I go into command prompt and run mmc C:\Windows\System32\printmanagement.msc i run into the same problem but when I go to administrative tools and right click run as my admin ID it works fine and I can then use the script with no issues and run from command prompt no issues. Strangely I think its related to policies but I am not sure how to retain that aspect on a reboot. Any insight would be amazing :)

I do have #RequireAdmin attached to it.

Thanks in advance

Share this post


Link to post
Share on other sites



Can you explain what your end goal is? Deploying Printers in a domain, or locally? Deleting Printers? Checking Print Job status? There is likely a way of accomplishing what you want without automating the Snap-In GUI.


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

The goal is access to the default view for ADUC/Printer Management/Computer Management. I currently have my main function is set to be a tray icon that you click the links in it and it launches the website/program etc.

It is more or less we troubleshoot and correct issues and short of just making a link on our desktop to said tools and right click running as all the time this gives us a shortcut :)

Like I said the odd thing is I can access them regularly through administrative tools first and the will work every time after. Almost like MMC is not triggering when I am running the above line of code. Very strange. >.>

Everything I found related to it says group policies but that would suggest it wouldnt work right in all 3 scenarios vs working in 1 and not the other 2 i imagine. Again still very new to the scripting aspect but I have been using the forums to get to what I got. only had to ask 2 questions prior to this :D

Edited by tweakster2010

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

a couple things to test/clarify

does this

a ) prompt for admin credentials?

b ) work to execute the desired console? 

c ) still exhibit the same behavior of prompting for credentials once you attempt to access something inside the console?

#RequireAdmin
shellexecute("printmanagement.msc")
Edited by boththose

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Share this post


Link to post
Share on other sites

I just fixed the issue. It was right in my face the entire time!!!

$iPID = RunAs(GuiCtrlRead($Username), "domain", GuiCtrlRead($Pass), 1, "mmc C:\Windows\system32\printmanagement.msc")

Changed the 0 to a 1 for the flag. I guess you can say it was a poor observation issue. :(

For your question though Boththose

Only using runas and command prompt mmc "C:\Windows\System32\printmanagement.msc" was having the issue. Shellexecute, right click run as different user or double click all work fine with UAC prompt and the credentials that applied. For my circumstances the flag was why it would wipe out data and give errors. no profile vs using profile. :)

Share this post


Link to post
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
Sign in to follow this  
Followers 0