running .exe as admin with username and password

This topic contains 4 replies, has 3 voices, and was last updated by  Tony Antony 1 year, 4 months ago.

  • Author
  • #56648

    Tony Antony


    $server = $env:mfdrives
    $apps = "\\$server\Apps\"
    Start-Process $apps\faxUploadSetup.exe

    When I run this, it opens the faxupload.exe software, which is good, but if I try to install it, it will ask for admin credentials. How would I store the admin usename and password in the script so that when a user runs it, it won't ask them?

    Thank you,


  • #56659

    Sonny Puijk
    $Username = "administrator"
    $Password = "ThisIsThePassword"
    $Credentials = New-Object PSCredential($UserName,$(ConvertTo-SecureString -AsPlainText -String $Password -Force))
    $server = $env:mfdrives
    $apps = "\\$server\Apps\"
    Start-Process $apps\faxUploadSetup.exe -Credential $Credentials

    You can obfuscate the credentials using base64 encoding or something else. I still haven't found of a foolproof way of providing admin credentials to scripts like this. They're always stored somewhere.

  • #56675

    Paal Braathen

    I haven't been able to try it myself yet, but I'd look into the credential manager rather than saving the password as plaintext.

    This module might assist you:

  • #56678

    Tony Antony

    Thank you all,
    I'll try that

  • #56681

    Tony Antony

    Now it says

    Start-Process : This command cannot be run due to the error: Logon failure: unknown user name or bad password.

    I verified that the username and passwords are correct.

You must be logged in to reply to this topic.