Jump to content

Recommended Posts

Posted

Agh! Can never seem to find the time to sit down and learn these things. Only one on the helpdesk today and need something sorted as soon as I can ideally.

 

Have my cap in hand, as usual extremely grateful to anyone who can help me out.

 

I need a vbs script (or batch file) to run on machines at startup (set through GP) to look for a folder in Program Files on all my client machines and if a certain folder is there, to set an AD group to Deny all.

 

For example, if the folder c:\Program Files\ferrets is found on a client computer, I'd like the permissions of c:\Program Files\ferrets and all subfolders and files to be set to Deny all for the group mydomain/students.

 

Anyone feeling helpful and can spoonfeed me this one?

 

Huge thanks for reading.

 

And no there's no ferrets loose. Well if there are they're not in the helpdesk.

Posted (edited)

You could deny permissions to the folder through group policy itself, without the need for a startup script.

 

In a GPO;

Server 2008+: Computer Configuration>Policies>Windows Settings>File System

Server 2003: Computer Configuration>Windows Settings>File System

 

Right-click File system and click add file.

In the "Add a file or folder" Dialogue box, you can browse to the folder if the app is installed on the server, however this is generally unlikely, so you will need to type in the "folder" field: %ProgramFiles%\Ferrets

The %programfile% is a variable and will look for where Program Files is set to, whether it be on C: or some other drive.

You may find if running on a 64-bit system, that you may need a slightly different variable, I haven't tried it yet so can't tell you.

 

If the folder doesn't exist, it does nothing, as soon as it does, it changes the permission.

 

Hope this information helps.

Edited by Jon_boy1984
  • Thanks 1
Posted

Thanks folks that's extremely helpful. Yes the policy settings are the more graceful solution, but the scripting reading looks awesome too.

 

Cheers tons!

 

Beer-200.jpg X 3

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



×
×
  • Create New...