HockeyFan Posted July 15, 2005 Share Posted July 15, 2005 Help!! I'm running a script that uses the RunAsSet command to us Administrative rights while running the script, but when when it is launched when a non-admin user is logged in, the called application fails. If I'm logged in as the administrator, it works perfectly. Does anyone have any ideas as to what is going wrong? Thanks. :"> Link to comment Share on other sites More sharing options...
GaryFrost Posted July 15, 2005 Share Posted July 15, 2005 Is this an Windows XP SP2 system? if so see open bugs. SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
HockeyFan Posted July 15, 2005 Author Share Posted July 15, 2005 When the script is run, it's Windows XP SP1. Where can I find "Open Bugs"? Link to comment Share on other sites More sharing options...
GaryFrost Posted July 15, 2005 Share Posted July 15, 2005 (edited) v3 Bug Reports shouldn't be a problem then if useing SP1 Edited July 15, 2005 by gafrost SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
Wus Posted July 15, 2005 Share Posted July 15, 2005 post your script.. I have used runasset alot and have figured out how it works fairly well Link to comment Share on other sites More sharing options...
HockeyFan Posted July 15, 2005 Author Share Posted July 15, 2005 post your script.. I have used runasset alot and have figured out how it works fairly well<{POST_SNAPBACK}>Here's my code...RunAsSet("Homer", @Computername, "**********") If FileExists("C:\Software\ePOAgent") Then FileMove("C:\Windows\Temp\XPSP2\FramePkg.exe", "C:\Software\ePOAgent\FramePkg.exe", 1) Else DirCreate("C:\Software\ePOAgent") FileMove("C:\Windows\Temp\XPSP2\FramePkg.exe", "C:\Software\ePOAgent\FramePkg.exe", 1) EndIf ;Check to see if Agent has already been installed. If so, uninstall and reinstall to verify proper connectivity. $result = FileExists("C:\Program Files\Network Associates\Common Framework\FrmInst.exe") If $result = 0 Then;0=failure, does not exist. ;If file does not exist, install FramePkg.exe (without embeded Homer credentials...plain FramePkg.exe from ePO server). SplashTextOn("McAfee ePolicy Agent", "" & @CR & "Installing McAfee ePO Agent software." & @CR & "" & @CR & "Please wait...", 400, 125, -1, -1, 0, "", 14, 400) Sleep(3000) SplashOff() Run("C:\Software\ePOAgent\FramePkg.exe /install=agent", "C:\Software\ePOAgent", @SW_SHOW) WinWait("McAfee Agent and Updater Setup", "Setup completed successfully.") ControlClick ("McAfee Agent and Updater Setup", "Setup completed successfully.", 2, "Left", 1) RunWait("C:\Program Files\Network Associates\Common Framework\cmdagent.exe /p /e /c", "C:\Program Files\Network Associates\Common Framework", @SW_SHOW) Else;If Agent is already installed. SplashTextOn("McAfee ePolicy Agent", "" & @CR & "Uninstalling McAfee software FrameServices (ePO Agent)." & @CR & "" & @CR & "Please wait...", 500, 125, -1, -1, 0, "", 14, 400) Sleep(3000) SplashOff() Run("C:\Program Files\Network Associates\Common Framework\FrmInst.exe /ForceUninstall", "C:\Program Files\Network Associates\Common Framework", @SW_SHOW) WinWait("McAfee Agent and Updater Setup", "Setup completed successfully.") ControlClick ("McAfee Agent and Updater Setup", "Setup completed successfully.", 2, "Left", 1) SplashTextOn("McAfee ePolicy Agent", "" & @CR & "Installing new McAfee ePO Agent software." & @CR & "" & @CR & "Please wait...", 400, 125, -1, -1, 0, "", 14, 400) Sleep(3000) SplashOff() Run("C:\Software\ePOAgent\FramePkg.exe /install=agent", "C:\Software\ePOAgent", @SW_SHOW) WinWait("McAfee Agent and Updater Setup", "Setup completed successfully.") ControlClick ("McAfee Agent and Updater Setup", "Setup completed successfully.", 2, "Left", 1) RunWait("C:\Program Files\Network Associates\Common Framework\cmdagent.exe /p /e /c", "C:\Program Files\Network Associates\Common Framework", @SW_SHOW) EndIfWhen I run this when logged in as a poweruser, the Mcafee installs fail. They succeed when I run when logged in as Admin.Thanks for you Help. Link to comment Share on other sites More sharing options...
Developers Jos Posted July 15, 2005 Developers Share Posted July 15, 2005 When I run this when logged in as a poweruser, the Mcafee installs fail. They succeed when I run when logged in as Admin.Thanks for you Help. <{POST_SNAPBACK}>You are not really clear about what is failing or what the errors are you get.Could it be that he Power user id not allowed to Move the file?RunAsSet() only changes the credentials for the programs shelled by Run() & RunWait()If that is the case you can have the script start itself first to make the whole script run under the admin credentials... something like:AutoItSetOption("RunErrorsFatal", 0) AutoItSetOption("TrayIconHide", 1) Break(0) $USERNAME = "Administrator" $PASSWORD = "Secret" $RUN = 0 ; run indicator ; retrieve the cycle from commandline If $CMDLINE[0] = 1 Then $RUN = $CMDLINE[1] If $RUN = 0 Then RunAsSet($USERNAME, @ComputerName, $PASSWORD) Run('"' & @ScriptFullPath & '" " 1"') If @error Then MsgBox(4096+32,"Error", "Error starting under admin mode") Exit EndIf ; commands go here that require Administrator rights SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Wus Posted July 15, 2005 Share Posted July 15, 2005 (edited) ill look at it when i get home... but how far does it get before it fails...wat error msg do you get?also,.. make sure to put the runasset() command at the end to log the admin outaslo try using the optional flag at the end of the runasset command... try all of the different flagsI personally like my workaround for starting a script with admin more that the command line one, but Jdebs is more "correct"mine solution$UserName = "username"$Password = "password"$fulldomainname = "Domain"If ClipGet() <> "tr1gg3r" Then run( "net use h: \\gc\" & @UserName ) ClipPut( "tr1gg3r") RunAsSet($UserName, $FullDomainName, $Password, 2) Run( Prog here you want to run as admin , "", @SW_HIDE) ExitEndIf; Admin Priviledged code hereRunasset()Clipput( "not tr1gg3r" ) Edited July 15, 2005 by Wus Link to comment Share on other sites More sharing options...
HockeyFan Posted July 15, 2005 Author Share Posted July 15, 2005 You are not really clear about what is failing or what the errors are you get.Could it be that he Power user id not allowed to Move the file?RunAsSet() only changes the credentials for the programs shelled by Run() & RunWait()If that is the case you can have the script start itself first to make the whole script run under the admin credentials... something like:AutoItSetOption("RunErrorsFatal", 0) AutoItSetOption("TrayIconHide", 1) Break(0) $USERNAME = "Administrator" $PASSWORD = "Secret" $RUN = 0 ; run indicator ; retrieve the cycle from commandline If $CMDLINE[0] = 1 Then $RUN = $CMDLINE[1] If $RUN = 0 Then RunAsSet($USERNAME, @ComputerName, $PASSWORD) Run('"' & @ScriptFullPath & '" " 1"') If @error Then MsgBox(4096+32,"Error", "Error starting under admin mode") Exit EndIf ; commands go here that require Administrator rights<{POST_SNAPBACK}>JdeB,Thanks for the info. Since I'm new to this scripting stuff, would you be so kind as to explain what the $CMDLINE[0] command is all about? If you don't have the time, then could you recommend somewhere where I could read up on this? I'm so confused!! I appreciate your help. Link to comment Share on other sites More sharing options...
Developers Jos Posted July 15, 2005 Developers Share Posted July 15, 2005 (edited) JdeB,Thanks for the info. Since I'm new to this scripting stuff, would you be so kind as to explain what the $CMDLINE[0] command is all about? If you don't have the time, then could you recommend somewhere where I could read up on this? I'm so confused!! I appreciate your help.<{POST_SNAPBACK}>$CMDLINE[0] will contain the number of commandline parameters defined on the commandline. $CMDLINE[1] will contain the first parameters ...etc Edited July 15, 2005 by JdeB SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now