Jump to content

Help with simple scrtipt.


Recommended Posts

Code:

RunAsSet("user","domain","password")

DirMove("%SYSTEMDRIVE%\Documents and Settings\All Users\Start Menu\Programs\Symantec Client Security","%SYSTEMDRIVE%\Documents and Settings\All Users\Start Menu\Programs\Utilities",1)

RunAsSet()

I can't get this script to work. I am trying to run the script from a network share for a user that doesn't have admin rights. :D Any thoughts? I think the problem is the path. Any help would be appreciated.

Link to comment
Share on other sites

  • Developers

Code:

RunAsSet("user","domain","password")

DirMove("%SYSTEMDRIVE%\Documents and Settings\All Users\Start Menu\Programs\Symantec Client Security","%SYSTEMDRIVE%\Documents and Settings\All Users\Start Menu\Programs\Utilities",1)

RunAsSet()

I can't get this script to work. I am trying to run the script from a network share for a user that doesn't have admin rights. :D Any thoughts? I think the problem is the path. Any help would be appreciated.

Sure.... RunASSet() ONLY sets different credentials for the Run() and RunWait() ....NOT any other commands.

You need to restart you script to accomplish that ...

I've posted that solution many times so I am sure you can find it .....

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

Code:

RunAsSet("user","domain","password")

DirMove("%SYSTEMDRIVE%\Documents and Settings\All Users\Start Menu\Programs\Symantec Client Security","%SYSTEMDRIVE%\Documents and Settings\All Users\Start Menu\Programs\Utilities",1)

RunAsSet()

I can't get this script to work. I am trying to run the script from a network share for a user that doesn't have admin rights. :D Any thoughts? I think the problem is the path. Any help would be appreciated.

Solution 1\1:

You can use RunAsSet ONLY for Run and RunWait command.

This function allows subsequent Run and RunWait functions to run as a different user (e.g. Administrator).

So, this script can not be runned.

i542

EDIT: You need be administrator to run this script.

Edited by i542

I can do signature me.

Link to comment
Share on other sites

I understand what JdeB is saying, as searching the forum is over looked. But I see a path issue also perhaps.

So yet again, I will offer a possible generic solution.

If $CMDLINE[0] And $CMDLINE[1] = '/admin' Then
    ; Now admin, do the task
    DirMove(@UserProfileDir & '\..\All Users\Start Menu\Programs\Symantec Client Security", "' & _
            @UserProfileDir & '\..\All Users\Start Menu\Programs\Utilities"', 1)
Else
    ; No parameters then restart as admin
    RunAsSet("user","domain","password")
    Run('"' & @ScriptFullPath & '" /admin')
EndIf

Your %SystemDrive% would not expand unless an Opt('ExpandEnvStrings', 1) is set to enable this.

Link to comment
Share on other sites

Sure.... RunASSet() ONLY sets different credentials for the Run() and RunWait() ....NOT any other commands.

You need to restart you script to accomplish that ...

I've posted that solution many times so I am sure you can find it .....

Ok RunAsSet aside, I still can't get Dirmove to work. If I replace %systemdrive% with c: the script works fine running it locally on an admin account. Any thoughts on whats going on with the path name? Thanks.

Link to comment
Share on other sites

Ok RunAsSet aside, I still can't get Dirmove to work. If I replace %systemdrive% with c: the script works fine running it locally on an admin account. Any thoughts on whats going on with the path name? Thanks.

Are you been v2 user? Replace it with @HomeDrive for drive you running. %systemdrive% is AutoIt v2 special variable, I think :D .

i542

I can do signature me.

Link to comment
Share on other sites

  • Developers

Ok RunAsSet aside, I still can't get Dirmove to work. If I replace %systemdrive% with c: the script works fine running it locally on an admin account. Any thoughts on whats going on with the path name? Thanks.

Easiest way to debug this is to show a msgbox() with the info you want to know just before the dirmove().

If you want the environment variables be translated you will have to set the appropriate OPT("ExpandEnvStrings",1) for it. Else it wil not be translated.

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

  • Developers

%systemdrive% is AutoIt v2 special variable, I think :D

Nah not really... its an Environment variable used in the good old DOS days ...... ( and still in many windows programs) :wacko:

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

Nah not really... its an Environment variable used in the good old DOS days ...... ( and still in many windows programs) :wacko:

Yeah, but it doesn't work it AutoIt, isn't that? :D

i542

I can do signature me.

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...