Jump to content

Problems with Inputbox and domainadmin credentials

Recommended Posts


Im trying to change a key in registry with credentials from a domainadmin. But it does not work.

Here is the code.

Dim $User, $Pass, $Domain = "domain"

$User = InputBox("Inloggning ", "Username", "")

$Pass = InputBox("Inloggning ", "Password","", "*")

; Set the RunAs parameters to use domain adminstrator account

RunAsSet( "$User", "$Domain", "$Pass",2 )

RegWrite( "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", "AutoRestartShell", "REG_DWORD", 0)

If I test the script with Beta Run it never stopps executing. It seems that i dont get the domainadmin rights to do the regsitry change.

I would be very happy for some help :P

Best regards


Link to post
Share on other sites

This line

RunAsSet( "$User", "$Domain", "$Pass",2 )

Should be

RunAsSet( $User, $Domain, $Pass,2 )

You do do not need the quotes round variable or they cease to be variables.

Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Link to post
Share on other sites


Thanks for your answer. But the problem remains. So i tested to put the username, domainname and password directly i the RunAsSet line, just to be shure that it was not the inputbox that generated the problem. But it still does not work.

Any suggestions?


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

    No registered users viewing this page.

  • Create New...