Jump to content
Sign in to follow this  
jerseyzuks

What is wrong with this line of code?

Recommended Posts

jerseyzuks

DirCreate (@MyDocumentsDir & "\TestFolder")

Works fine on my machine (the computer I am writing the script from), but it doesn't create the "test folder" on everyone else's machine. All the users can create the folder manually, so it isn't a read/write permissions issue.

Both my computer, and the end users computers are all Win 7 machines.

UAC prompt does come up when the script is run, and an admin ID is entered. Users are logged on to their own machines with their own IDs (non-admin)

Am I missing something really silly?

Share this post


Link to post
Share on other sites
JLogan3o13

Hi, jerseyzuks. Just to confirm, you mention you're entering an Admin ID. Does this mean you're doing a RunAs at some point. Or are you just adding #RequireAdmin at the top?


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites
jerseyzuks

Hi, jerseyzuks. Just to confirm, you mention you're entering an Admin ID. Does this mean you're doing a RunAs at some point. Or are you just adding #RequireAdmin at the top?

There is a #RequireAdmin at the top, but the users need to enter an admin ID for the User Access Control window when launching the script

Share this post


Link to post
Share on other sites
zorphnog

If you are requiring that an Admin run it, then the script is running in the context of the admin user supplied to UAC.

Share this post


Link to post
Share on other sites
JLogan3o13

I'm assuming you are an admin. Does it work for you on one of their computers? I think you end up running it as the Admin account.

Edit: zorphnog beat me to the punch ;)

Edited by JLogan3o13

√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites
jerseyzuks

If you are requiring that an Admin run it, then the script is running in the context of the admin user supplied to UAC.

but the next line of code is

ShellExecute (@MyDocumentsDir)

and it opens the users mydocuments folder

Share this post


Link to post
Share on other sites
jerseyzuks

I'm assuming you are an admin. Does it work for you on one of their computers? I think you end up running it as the Admin account.

Edit: zorphnog beat me to the punch ;)

Yes. If I log on to windows with my ID, and enter my ID into the UAC... the script works just fine

Share this post


Link to post
Share on other sites
zorphnog

Reading (i.e. opening the directory) is different than writing. Creating a directory would require write permissions (usually not granted to admins by default for a user's personal folder), but if you are running with UAC your permissions set is that of the administrator.

Edit:

Does the DirCreate function return 1 or 0?

Edited by zorphnog

Share this post


Link to post
Share on other sites
jerseyzuks

well, it is absolutely UAC's fault. Directory was being created in the profile of the admin (I didn't see it before, because the script deletes the folder at the end)

Thanks for the help guys, back to the drawing board

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.