Jump to content

Running a file with domain admin prevelige


kcap
 Share

Recommended Posts

Hello all,

I made a script to copy a folder from the server and paste it on the domain user's computer.

I want the script to be runned with admin prevelige, but when users run it they get a popup to login as admin.

Please how can I fix this issue.

Here is the script:

#RequireAdmin
RunAs(user, domain, password, "", @ScriptDir & "\vectorworks_2017.exe")

;~ source
Global $FileLocation1 = "domain\vw2017_sp04"

;~ destination
Global $FileLocation2 = "C:\Program Files\Vectorworks 2017"

If FileExists ("C:\Program Files\Vectorworks 2017\sp04.txt") Then
        ConsoleWrite("The file exists. FileExist returned: "& @LF)

Else

FileDelete("C:\Program Files\Vectorworks 2017\Vectorworks2017.exe")

Sleep(2000)

    If FileExists ("C:\Program Files\Vectorworks 2017\Vectorworks2017.exe") Then
        ConsoleWrite("The file exists. FileExist returned: "& @LF)

        MsgBox(64, "", "VectorWorks update is not installed, please close VectorWorks and run the script again!")

    Else

    DirCopy($FileLocation1, $FileLocation2, 1)

    MsgBox(64, "", "done, you can run VectorWorks now")

    EndIf

EndIf

 

Link to comment
Share on other sites

  • Moderators

@kcap If you are embedding domain admin credential into a script remind me never to work for your company. You obviously have access to domain-level credentials, why are you not simply doing this correct way, through GPO?

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

no i encrypt the domain credential with other file and include it in my script. i didn't post the second file here, not needed.

everything with the script run good the only thing i want is how to run it as admin by a standard user. 

Link to comment
Share on other sites

  • Moderators

Yes, run it as a service, or use GPO. You're trying to give a normal user the ability to run something as a domain administrator, without giving them domain administrator credentials. Just curious why you're trying to hack your way through this when there are best practice ways of accomplishing this already in place?

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...