Overclock.net - An Overclocking Community - Reply to Topic

Thread: Question about Powershell Scripting Reply to Thread
Title:
Message:

Register Now

In order to be able to post messages on the Overclock.net - An Overclocking Community forums, you must first register.
Please enter your desired user name, your email address and other required details in the form below.
User Name:
If you do not want to register, fill this field only and the name will be used as user name for your post.
Password
Please enter a password for your user account. Note that passwords are case-sensitive.
Password:
Confirm Password:
Email Address
Please enter a valid email address for yourself.
Email Address:

Log-in


  Additional Options
Miscellaneous Options

  Topic Review (Newest First)
01-10-2019 11:29 AM
Destrto
Quote: Originally Posted by axipher View Post
Glad you figured it out, just our of curiosity, where were you saving the CSV file before?
I discovered that I was originally saving the CSV file to my own user documents folder. Which is what was causing the other user to get the "Access Denied" message.
01-09-2019 08:12 PM
Acecool The user may have admin rights, but that doesn't mean the application is able to use them without running elevated ( command prompt, for instance, when running batch files still needs to be elevated otherwise you run into issues )...

You can either run elevated, or you can change the permissions to write to the directory using the security tab and add the normal user group to allowed instead of admin.

Some folders will allow reading / writing by default - I think the documents folder is one of these folders.
01-09-2019 02:55 PM
axipher
Quote: Originally Posted by Destrto View Post
Just an update. Moving the Script to the Public Documents folder, and telling the script to create the CSV file within that same folder answered my issue. I am now able to have other users run that script without getting the "Access Denied" error from before.

Thank you guys for letting me bounce this off of you to get the info that helped.
Glad you figured it out, just our of curiosity, where were you saving the CSV file before?
01-09-2019 08:31 AM
Destrto Just an update. Moving the Script to the Public Documents folder, and telling the script to create the CSV file within that same folder answered my issue. I am now able to have other users run that script without getting the "Access Denied" error from before.

Thank you guys for letting me bounce this off of you to get the info that helped.
01-09-2019 07:27 AM
Destrto
Quote: Originally Posted by axipher View Post
Might need to see the relevant parts of the script that generate the CSV file and call out it's file name.


Or at the minimum, where is the CSV file being stored?
1) on a network location somewhere
2) in the logged in user's directory
3) on the local machine in a secure folder that needs admin rights


Without much information to go on, I can only assume it tries to overwrite the same CSV file when it is run from another user, but the CSV file is locked by the first user it was run on, or was run by an admin account and created in an admin folder or something.
I'll try to answer as best I can and help shed some light on the needed details.

The CSV file is set to be created in the "Users\Public\Documents" folder (I have changed it from the previous reply to this thread).
01-09-2019 07:13 AM
axipher Might need to see the relevant parts of the script that generate the CSV file and call out it's file name.


Or at the minimum, where is the CSV file being stored?
1) on a network location somewhere
2) in the logged in user's directory
3) on the local machine in a secure folder that needs admin rights


Without much information to go on, I can only assume it tries to overwrite the same CSV file when it is run from another user, but the CSV file is locked by the first user it was run on, or was run by an admin account and created in an admin folder or something.
01-09-2019 07:12 AM
Destrto
Quote: Originally Posted by doritos93 View Post
It means the user running the task doesn't have permission to write to the file or directory you do.

There are few ways to go about doing this but quickly it would just mean changing the location of the csv to a place where your underling has access
Ok, that makes sense. What's weird with that, though, is that myself and the other user testing this script with me both have admin access.

Would it possibly be better to set the file location to somewhere like the public documents folder in that case?
01-09-2019 07:10 AM
doritos93 It means the user running the task doesn't have permission to write to the file or directory you do.

There are few ways to go about doing this but quickly it would just mean changing the location of the csv to a place where your underling has access
01-09-2019 07:05 AM
Destrto
Question about Powershell Scripting

Hey guys, I have a question related to Powershell Scripting. I am admittedly very new to this, so bear with me, as I've only just started googling this topic yesterday.

So, I currently have a script, that I'm running on a Server 2008 R2 environment, that pulls all inactive users from Active Directory and lists their last logon timestamp. Then exports that data to a CSV file. It works exactly how I would like. However, If another user logs in under their own credentials to run that script, they get "Access Denied" to the CSV filename that the script tries to create.

Is there anything I can do or change about the script so that any user can run this script and have the file be created without this issue?

Any help would be appreciated.

Posting Rules  
You may post new threads
You may post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off