Sign in to follow this  
Followers 0
kcap

Running a file with domain admin prevelige

6 posts in this topic

#1 ·  Posted

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

 

Share this post


Link to post
Share on other sites



#2 ·  Posted

@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?


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

Share this post


Link to post
Share on other sites

#3 ·  Posted

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. 

Share this post


Link to post
Share on other sites

#4 ·  Posted

Any thoughts?

Share this post


Link to post
Share on other sites

#5 ·  Posted

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?


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

Share this post


Link to post
Share on other sites

#6 ·  Posted

I solved the problem and adjust the script :)

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