Sign in to follow this  
Followers 0
jerseyzuks

What is wrong with this line of code?

9 posts in this topic

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



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

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

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

#5 ·  Posted (edited)

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

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

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

#8 ·  Posted (edited)

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

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  
Followers 0