Jump to content

Recommended Posts

I can't seem to get the Isadmin to work on my script. I'm running windows 7 pro and I have an windows xp machine that I have been testing this on too, and it just hangs there and not works. Does any have any idea's on how to fix this problem?

If DirCopy("N:\software\new_system\Teamviewer", "C:\TeamViewer", 1) Then
FileCopy("C:\Teamviewer\TeamViewer_Host_Setup-ckj.exe", "C:\Documents and Settings\cbungard\Desktop", 1)
Sleep(1000)
EndIf
If IsAdmin() Then
ShellExecute("C:\Documents and Settings\cbungard\Desktop\TeamViewer_Host_Setup-ckj.exe")
WinWait("Open File - Security Warning", "Name:")
WinActivate("Open File - Security Warning", "Name:")
ControlClick("Open File - Security Warning", "Name:", 4423)
WinWait("TeamViewer 7 Host Setup", "Welcome to TeamViewer 7 Host")
WinActivate("TeamViewer 7 Host Setup", "Welcome to TeamViewer 7 Host")
ControlClick("TeamViewer 7 Host Setup", "Welcome to TeamViewer 7 Host", 1)
WinWait("TeamViewer 7 Host Setup", "How do you want to use TeamViewer")
WinActivate("TeamViewer 7 Host Setup", "How do you want to use TeamViewer")
ControlClick("TeamViewer 7 Host Setup", "How do you want to use TeamViewer", 1201)
ControlClick("TeamViewer 7 Host Setup", "How do you want to use TeamViewer", 1)
WinWait("TeamViewer 7 Host Setup", "Press Page Down to see the rest of the agreement.")
WinActivate("TeamViewer 7 Host Setup", "Press Page Down to see the rest of the agreement.")
ControlClick("TeamViewer 7 Host Setup", "Press Page Down to see the rest of the agreement.", 1203)
ControlClick("TeamViewer 7 Host Setup", "Press Page Down to see the rest of the agreement.", 1)
WinWait("TeamViewer 7 Host Setup", "You have to supply a password.")
WinActivate("TeamViewer 7 Host Setup", "You have to supply a password.")
ControlSetText("TeamViewer 7 Host Setup", "You have to supply a password.", 1200, "1234")
ControlSetText("TeamViewer 7 Host Setup", "You have to supply a password.", 1201, "1234")
ControlClick("TeamViewer 7 Host Setup", "You have to supply a password.", 1)
Sleep(9000)
EndIf
If ShellExecute("C:\TeamViewer\TeamViewerRegistryScript.cmd") Then
Sleep(10000)
EndIf
If IsAdmin() Then
ShellExecute("C:\TeamViewer\Teamviewer-x86.reg")
WinWait("Registry Editor", "&Yes")
WinActivate("Registry Editor", "&Yes")
ControlClick("Registry Editor", "&Yes", 6)
WinWait("Registry Editor", "OK")
WinActivate("Registry Editor", "OK")
ControlClick("Registry Editor", "OK", 2)
Sleep(5000)
EndIf
ShellExecute("C:\TeamViewer\TurnOnTeamViewer.cmd")
Link to post
Share on other sites

How are you initiating the script? You can create a scheduled task, that runs at highest priviledge...that way, you just start the task, which get's around UAC (the legal way)

IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
Link to post
Share on other sites

Hi,

On my PC running Windows 7 64 bits; the script below works perfectly, and display the right message box depending on presence or absence of the clause #requireadmin:

#requireadmin
; Administration rights check
if IsAdmin()= 0 Then
; displayed only if requireadmin is not present
MsgBox(0, "Ordinary user", "Administrator Rights not granted")
Else
; displayed if requireadmin is present
MsgBox(0, "Administrator", "Administrator Rights granted")
EndIf
Exit (0)

The #requireadmin clause seems to be evaluated at the script lunch time and the windows asking to grant the administrator rights is opened and to grant the rights is accepted. If refused, the script is not launched. Thus, in script with the clause #requireadmin, the use of IsAdmin() is not relevant.

I tried to make a script, which tests the administrator rights using IsAdmin(), and then if not granted asks for them. Obviously, the clause #requireadmin does not allow to create such script and the script below does not work as I’d like to:

if IsAdmin()= 0 Then
MsgBox(0, "Ordinary user", "Administrator Rights not granted")
#requireadmin
             if IsAdmin()= 0 Then
                         MsgBox(0, "After requireadmin", "Administrator Rights not granted")
             Else
                         MsgBox(0, "After requireadmin", "Administrator Rights granted")
             EndIf
Else
MsgBox(0, "Administrator", "Administrator Rights granted")
EndIf
Exit (0)

Do you have any idea by what the clause #requireadmin is to be replaced in order to get the correct message boxes?

Brges

User3D

Edited by User3D
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...