Jump to content

RunAs Not Working


MattX
 Share

Recommended Posts

The most robust solution I've found for cases like this is to:

1) Make a stage one script which does the RunAs work; it simply calls the second script with the privileged credentials. I install this script on the local machine in a location that both the interactive user and the run-as user could access.

2) Make a stage two script that (when run as a privileged user) establishes a network connection with DriveMapAdd and performs the tasks that require the network connection. You can install it on separately the local computer, have the stage one script fetch it from a user accessible network share at run time or FileInstall() it locally with the stage one script to a location that the run-as user can read. This script would be essentially your script as it is now with the addition of DriveMapAdd and the removal of RunAsWait.

As Jos was hinting a gotcha of running processes as another user is that you don't inherit any network authentication/connectivity from the interactive user. Depending on your network the run-as process might be able to access files from a UNC path if the location is world-readable, but not in every case. DriveMapAdd lets you specify a network path and credentials for accessing it, and by using it you both ensure that you're making the desired connection, and you can also specify a location that isn't world readable for increased security.

Yes yes yes, there it was. Youth must go, ah yes. But youth is only being in a way like it might be an animal. No, it is not just being an animal so much as being like one of these malenky toys you viddy being sold in the streets, like little chellovecks made out of tin and with a spring inside and then a winding handle on the outside and you wind it up grrr grrr grrr and off it itties, like walking, O my brothers. But it itties in a straight line and bangs straight into things bang bang and it cannot help what it is doing. Being young is like being like one of these malenky machines.

Link to comment
Share on other sites

Thanks for the advice - I'll go with the two stage script first [ as that is how I got elements of it to work to start with & like Dave suggested ] - once that is working and I'm happy with it I'll try and code around the fact of higher credentials like Jos showed an example of.

Thanks once again.

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