RE: Help needed setting user security rights through a script



'this script will set permission on given folder...(6th line of script)

dim Wshshell, fso
Set Wshshell=CreateObject("WScript.Shell")
Set fso = CreateObject("Scripting.FileSystemObject")

'Folder on which permissions will be applied,
folderPath="c:\SomeFolder"

'Path of cacls.exe, it is found at below mentioned location on XP Machines.
caclsPath = "c:\Windows\System32\cacls.exe"

If (fso.FileExists(caclsPath)) Then
If (fso.FolderExists(folderPath)) Then
oExec=WshShell.run(caclsPath & " " & folderPath & " /t /E /P
users:C",0,True)
'users:C means "Users" group will be assigned Change permission. Refer
to CACLS help (cacls /? at command prompt) for more info.
if oExec <> 0 then
wscript.echo "Unable to set permissions.Error: " & err.number & ":" &
err.description
wscript.quit oExec
else
wscript.echo "Successfully set permissions on folder." 'comment this line
if you don't want to display the message,
end if
else
wscript.echo "Unable to set permissions, source folder not found. "
wscript.quit -1
End If
else
wscript.echo "Unable to set permissions, CACLS.EXE was not found."
wscript.quit -1
End If



hope it helps...

Umesh
--
When you are unable to keep your eyes open, do go and sleep for few hours!!!


"Fran" wrote:

> I have a user that gets a new version of an application monthly. This
> requires the uninstall and reinstall of the application (it's a poor
> design to be sure but I have to deal with it as it's a company product
> they use.)
>
> Recently we implemented "Least Privaleges" at this office to reduce
> the incindence of spyware (which seems to be working well, I might
> interject) but it does mean that the user does not have permission to
> install or uninstall applications.
>
> I got some assistance on automating the install and uninstall from
> another group but I have not found a way to set permissons through a
> script. What I need to do is this:
>
> Uninstall the existing app
> Reinstall the new version
> <both of the above are now done through a script>
>
> Set user rights to the path that gives my user "Modify" security
> rights.
>
> This is an older app that has a hard coded path off the root of C:. I
> have no way to change where it installs itself. Is there a way I can
> script setting the user access rights to this folder?
>
> Thanks for any help!
>
> -Fran-
>
.



Relevant Pages

  • Re: MoveFile Method
    ... > a workstation to a folder in a server. ... > running the script with WScript if I run it with CScript ... > I get the message: Network Access is Denied ... must have the permission. ...
    (microsoft.public.scripting.wsh)
  • Re: editing licensed shows
    ... You can do almost anything with CHESS if you get permission. ... the first productions done after Broadway was by the Long Beach Civic ... The script was very much changed by director ...
    (rec.arts.theatre.musicals)
  • Re: Error
    ... Maybe a difference in the permission that the ... WEB-ED writes the script to the ... TEMP folder and then calls wscript.exe to run it. ... Vista has some strange permission ...
    (microsoft.public.scripting.vbscript)
  • Re: Computer Startup Batch File via GPO (not working)
    ... Like I mentioned in my first post, a situation setup on a W2k8 domain behaves differently than on a similarly configured W2k3.sp1 Enterprise domain. ... If you're certain it's a permission issue, then add Everyone READ to the source folder and see what happens. ... > that the script is being called. ...
    (microsoft.public.windows.group_policy)
  • Re: User Account Security
    ... Better post this under the original posting, so that anybody could follow it and find it again. ... after some times about 30 minutes all permission changed with other ... I created a script and disabled this settings ... the password you add two deny ACE's to the DACL. ...
    (microsoft.public.windows.server.active_directory)

Quantcast