Sign in to follow this  
Followers 0
giggity

Help with simple scrtipt.

10 posts in this topic

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.

Share this post


Link to post
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.

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


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

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.

Share this post


Link to post
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.

Share this post


Link to post
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.

Share this post


Link to post
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.

Share this post


Link to post
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.

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.


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

%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:

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

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

i542

True except for Opt('EvpandEnvStrings', 1) :D , and...

$systemdrive = EnvGet('Systemdrive')

Err hint...Reply #4? Or did I make a boo boo there? :wacko:

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