Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 316
  • Last Modified:

Change local folder security through AD

I have an application that all my users use, in the application there is a way to configure certain keys to do certain functions. When this is changed the users get an error that they are unable to update the config file. I fixed this issue by loggin in as admin and changing the security on the folder to read/write. The when the user logs in he can make changes. Is there a script or something to change the folder security or do i need to go to every pc and do it.
0
ICINTRACOM
Asked:
ICINTRACOM
  • 3
  • 2
2 Solutions
 
mikeleebrlaCommented:
you can do it though the administrative share,,, either one by one or with a script:

the local admin share is \\hostname\C$

0
 
ICINTRACOMAuthor Commented:
not sure that will work. I don't want to share the folder, i just want the security on the folder to be set for everyone have read/write permissions. the folder is in the root of c:
0
 
mikeleebrlaCommented:
it will work,, the folder is shared already by default on all windows systems for administrative purposes... i never instructed you to create a new share at all.
0
Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

 
ICINTRACOMAuthor Commented:
You are correct sorry. Now how can i change the security on the folder through a vb script.
0
 
mikeleebrlaCommented:
that i do not know as i dont really use scripts very much at all.
0
 
oBdACommented:
You can do it from the command line using cacls:
cacls \\RemoteMachine\C$\FolderName /t /e /g User:C

The following script can change either a single remote machine, passed as argument, or a list of machines (one machine name per line); for the list, use /L as the first argument, the path and name of the list file as second argument. Just adjust the settings at the beginning (and maybe the line with the permissions, if necessary). Note that the script is currently in test mode, it will only echo the command it would otherwise execute. Remove the ECHO where indicated to run it for real. Oh, and if it's processing a list of machines, it will give you a list of machines (changesec.txt, in the script's directory) where the change wasn't applied, because they were turned off. Rename this file before you use it as list file for another round!
example:
changesec remotemachine
changesec /L machinelist.txt

====8<----[ChangeSec.cmd]----
@echo off
setlocal
set TargetFolder=C$\SomeFolder
set FailedFile=%~dpn0.txt

if %1.==. goto leave
if /i not %1.==/L. goto process
if %2.==. goto leave
set MachineFile=%2
set MachineFile=%MachineFile:"=%
if not exist "%MachineFile%" goto leave
:: *** Process a list of machines:
if exist "%FailedFile%" del "%FailedFile%"
for /f %%a in ('type "%MachineFile%"') do call :process %%a
goto leave

:process
set Machine=%1
set Machine=%Machine:\=%
echo Processing %Machine% ...
ping -n 1 %Machine% | find "TTL" >NUL
if errorlevel 1 goto :NoResponse
:: *** Set the permissions on the target folder:
:: *** Test mode: Remove the ECHO in the following line to run the script for real:
ECHO cacls "\\%Machine%\%TargetFolder%" /t /e /g Users:C
goto :eof

:NoResponse
echo ... not responding.
if not "%MachineFile%"=="" >>"%FailedFile%" echo %Machine%
goto :eof

:leave
====8<----[ChangeSec.cmd]----
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now