×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Self-Elevate Code Stops Script from Running Executable

Self-Elevate Code Stops Script from Running Executable

Self-Elevate Code Stops Script from Running Executable

(OP)
I'm just a hack who shoehorns VBScript code I find on the web together so I fully admit I don't know what I'm doing.

I'm trying to query a user for their BIOS password, create a command line including that variable and feed the command line to the program HPQPswd64.exe to generate an encrypted password file called PWORD.BIN. Because this file will then be fed into a command line of another program that requires elevation, I need to self-elevate the script.

My script works fine until I add the self-elevation code and I'm not sure what's happening due to my ignorance of how the elevation script works. The script and the executable are in the same folder and the PWORD.BIN file it creates is placed in the same folder, as well.

The code I have that works is:

CODE -->

Set WshShell = WScript.CreateObject("WScript.Shell")

DIM PwdProg, PWORD

PWORD=InputBox("              --===== WARNING =====--          Disabling SecureBoot may trigger BitLocker Recovery on next reboot.  Make sure you have the BitLocker Recovery key on hand before disabling SecureBoot!!!", "SecureBoot Disabler")

PwdProg = """"&"HPQPswd64.exe /S /P"&""""&PWORD&""""&" /F"&""""&"PWORD.BIN"&""""&""""

WshShell.Run "cmd /c " & PwdProg, 0, True 

then, if I add the self-elevation code, it elevates, asks for input but the executable doesn't run (I think) and no PWORD.BIN is created:

CODE -->

'--------------
'Start of UAC workaround code
If WScript.Arguments.length =0 Then
Set objShell = CreateObject("Shell.Application")

objShell.ShellExecute "wscript.exe", Chr(34) & _
WScript.ScriptFullName & Chr(34) & " uac", "", "runas", 1
Else

'--------------
'Start of code

'This code is ran as an elevated user, ie. Administrator

strComputer = "."


Set WshShell = WScript.CreateObject("WScript.Shell")

DIM PwdProg, PWORD

PWORD=InputBox("              --===== WARNING =====--          Disabling SecureBoot may trigger BitLocker Recovery on next reboot.  Make sure you have the BitLocker Recovery key on hand before disabling SecureBoot!!!", "SecureBoot Disabler")

PwdProg = """"&"HPQPswd64.exe /S /P"&""""&PWORD&""""&" /F"&""""&"PWORD.BIN"&""""&""""

WshShell.Run "cmd /c " & PwdProg, 0, True

'--------------
'End of code

'--------------
'End of UAC workaround code

End If 

Any insight you can give me on why this is happening and how to fix it would be VERY appreciated.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login


Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close