I need to disable cd-rom and usb drive access for certain users, via a batch file or something similar so that it can be scripted/automated. Any suggestions on how to do this?

Generally that is a setting that actually disables on the computer rather than an end user. My suggestion would be to set up a guest account on the computer and disable those ports for that account. And when you are on the computer, you being the Admin, you can re-enable those.

If you want to change this setting in same pc ,Then go to the security tab and change the permission .If you want to change the permission on network pc then use server window and change the permission .

Usually, this is done in a domain, but basically you would create a group policy to disable removable storage. I'll have to check my machine at home (I'm at work now) to see if there is a local policy to disable removable storage.

Update: I checked at this site - http://blog.dreamcss.com/tech/disable-access-to-removable-storage-devices-in-windows-7/ it it MAY be possible to do via Local Group Policy Editor.

You can edit local group policy for a specific user group. You will need to setup a unique local user group for these users.

Here are instructions to access group policy for a specific usergroup:
http://superuser.com/questions/134066/how-to-apply-group-policy-settings-to-specific-local-accounts-in-windows

Short Version:
1. Start -> Run -> mmc
2. File -> Add/Remove Snap-in
3. Scroll Down the list on the left hand side and find Group Policy Object
4. Select Group Policy Object and hit add
5. Click Browse when the box pops up
6. Click the Users tab at the top of the box
7. Select the user you wish to configure
8. Click OK
9. Click Finish
10. Click OK
11. Click File -> Save As
12. Name the file something useful like "Tom's Group Policy Preferences"
13. Click Save

Now you should be able to quickly load this by going into your administrative tools folder and clicking on the "Tom's Group Policy Preferences" icon.

Important: Do not applying the settings the administrator account.

Here is an article with all of the settings, and where they are located.

http://www.techrepublic.com/blog/the-enterprise-cloud/disable-removable-media-through-windows-server-2008s-group-policy-configuration/

For those that don't want to read the article they are located at:
Computer Configuration -> Administrative Templates -> System -> Removable Storage Access

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.