RE: Help needed setting user security rights through a script
- From: Umesh Thakur <UmeshThakur@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Mon, 23 Jan 2006 06:46:01 -0800
'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-
>
.
- Follow-Ups:
- References:
- Prev by Date: RE: getting response time on ping
- Next by Date: Re: [MSH] MSH Not So Great For Interactive Users
- Previous by thread: Help needed setting user security rights through a script
- Next by thread: Re: Help needed setting user security rights through a script
- Index(es):
Relevant Pages
|