Petri IT Knowledgebase Forums
 

Petri.co.il forums Home Forums Start Page Forums Frequently Asked Questions FAQ Member List Members List
Go Back   Petri IT Knowledgebase Forums > Windows Scripting > General Scripting
Petri.co.il is happy to award auglan the title of Most Valuable Member !!!
Register Calendar Calendar Search Petri IT Knowledgebase Forums Search Todays Posts Today's Posts Mark Forums Read

Notices

Script to change permissions on a System32 file

Script to change permissions on a System32 file

this thread has 7 replies and has been viewed 8926 times

Closed Thread
 
Thread Tools Search this Thread Display Modes
  #1  
Old 17th September 2007, 20:02
biggles77's Avatar
biggles77 biggles77 is offline
Administrator
 
 Join Date: Dec 2003
  6 month star 12 month star
 Location: Nowhere that I like.
 Posts: 10,758
 Reputation: biggles77 is a splendid one to beholdbiggles77 is a splendid one to beholdbiggles77 is a splendid one to beholdbiggles77 is a splendid one to beholdbiggles77 is a splendid one to beholdbiggles77 is a splendid one to beholdbiggles77 is a splendid one to behold (734)
Default Script to change permissions on a System32 file

I need to change the permission on a driver file located in C:\Windows\System32 folder. If the file is called Mouse.drv and the User Group has Read & Execute plus Read permissions, is it possible to create a script to change the permissions to Write or possible Modify? This script needs to be able to run from a standard login.bat script or from an external script using the CALL function.

This needs to be done on several hundred PCs so they can run some old educational program that was originally designed for Windows 3.1. My feeble attemps so far have been shall we say......feeble.
__________________
"There I stood at the bar, wearing a Mae West, no jacket, and beginning to leak blood from my torn boot. None of the golfers took any notice of me - after all, I wasn't a member!" Kenneth Lee - after being shot down during the Battle of Britain on the 18th August 1940.

************************************************** **********************
** Remember to give credit where credit is due and leave reputation points where appropriate **
************************************************** **********************
  #2  
Old 17th September 2007, 23:15
martin77's Avatar
martin77 martin77 is offline
Casual
It's not a coincidence
 
 Join Date: Aug 2005
  6 month star 12 month star
 Posts: 64
 Reputation: martin77 will become famous soon enoughmartin77 will become famous soon enough (115)
Default Re: Script to change permissions on a System32 file

Use Microsoft's Xcacls.vbs
download and take a look at the examples at: How to use Xcacls.vbs to modify NTFS permissions
you can place the Xcacls.vbs at the NTELOGON folder, and call it from your login.bat script:
Code:
cscript %0\..\Xcacls.vbs C:\Windows\System32\Mouse.drv /G EVERYONE:f
Important: Note that this command example replaces the permissions on Mouse.drv, it doesn't "append" them!
To "append" the permissions check the /P option, but note that /P behaves like /G if there are no rights set for EVERYONE.

good luck,
Martin77.
  #3  
Old 18th September 2007, 10:28
tonyyeb's Avatar
tonyyeb tonyyeb is offline
Moderator
 
 Join Date: Dec 2004
  6 month star 12 month star
 Location: Hull, UK
 Posts: 2,182
 Reputation: tonyyeb is a jewel in the roughtonyyeb is a jewel in the roughtonyyeb is a jewel in the rough (283)
Default Re: Script to change permissions on a System32 file

Can you not set a startup script and then use xcacls?
__________________
Server 2000 MCP
Development: ASP, ASP.Net, PHP, VB, VB.Net, MySQL, MSSQL - Check out my blog http://tonyyeb.blogspot.com

** Remember to give credit where credit is due and leave reputation points To grant some reputation points to the user that helped you, just click on the little Yin-Yang icon on the right of the user's answer and follow the prompt. where appropriate **
  #4  
Old 18th September 2007, 11:55
martin77's Avatar
martin77 martin77 is offline
Casual
It's not a coincidence
 
 Join Date: Aug 2005
  6 month star 12 month star
 Posts: 64
 Reputation: martin77 will become famous soon enoughmartin77 will become famous soon enough (115)
Default Re: Script to change permissions on a System32 file

Not sure I understood the question.
You can even run the Xcacls.vbs from your workstation against a different machine:
Code:
Xcacls.vbs \\SOMEPC\C$\Windows\System32\Mouse.drv /G EVERYONE:f
  #5  
Old 18th September 2007, 14:28
Rems's Avatar
Rems Rems is offline
Moderator
 
 Join Date: Mar 2005
  6 month star 12 month star
 Location: NL
 Posts: 2,265
 Reputation: Rems is a splendid one to beholdRems is a splendid one to beholdRems is a splendid one to beholdRems is a splendid one to beholdRems is a splendid one to beholdRems is a splendid one to beholdRems is a splendid one to beholdRems is a splendid one to behold (903)
Default Re: Script to change permissions on a System32 file

summarised:
Quote:
This script needs to be able to run from a standard login.bat script or from an external script using the CALL function.
This needs to be done on several hundred PCs
A login.bat runs under the credendials of the logged-on user. Standard users are not allowed to change permissions, and are not allowed to change anything in the SystemRoot. That is why you must use a computer start-up script for this, like Tony suggested.

http://support.microsoft.com/kb/135268
- Xcacls.exe support the use of the /Y switch and it replaces Cacls.exe
- Xcacls.vbs replaces xCacls.exe http://www.jsifaq.com/SF/Tips/Tip.aspx?id=8225

You can link the xcacls.vbs as a start-up script in a GPO linked to the client computers OU. There, in the script parameters box you can also enter the parameters for the commandline (so you dont have to create a separate script for these switches)


Or, if you planned to run it against remote computers.
Code:
For /f %%a in (c:\computerlist.txt) Do cscript //B //NoLogo "\\server\share\XCACLS.vbs" "c:\Windows\system32\test.txt" /E /G "Authenticated Users":F /SERVER %%a /Q
Where /SERVER %%a automaticaly is the name of a remote computer from the list.
optionaly, you can also use the /User and /Pass switches to use alternate credentials (by default the script will use your credentials to connect to the remote computers).
http://support.microsoft.com/kb/825751


\Rems

Last edited by Rems; 18th September 2007 at 14:57..
  #6  
Old 18th September 2007, 17:39
biggles77's Avatar
biggles77 biggles77 is offline
Administrator
 
 Join Date: Dec 2003
  6 month star 12 month star
 Location: Nowhere that I like.
 Posts: 10,758
 Reputation: biggles77 is a splendid one to beholdbiggles77 is a splendid one to beholdbiggles77 is a splendid one to beholdbiggles77 is a splendid one to beholdbiggles77 is a splendid one to beholdbiggles77 is a splendid one to beholdbiggles77 is a splendid one to behold (734)
Default Re: Script to change permissions on a System32 file

Thanks guys, I appreciate the help. I just wanted this to be as easy as possible so when I leave this site the next moron doesn't have the same problems with the ancient software that I have had. Guess it ain't going to be as simple as I wanted.

Points for everyone because I am getting too old to learn this shit properly and can only watch in awe at the scripting skills you have (I am annoyed I had forgotten about Xcalcs though).
__________________
"There I stood at the bar, wearing a Mae West, no jacket, and beginning to leak blood from my torn boot. None of the golfers took any notice of me - after all, I wasn't a member!" Kenneth Lee - after being shot down during the Battle of Britain on the 18th August 1940.

************************************************** **********************
** Remember to give credit where credit is due and leave reputation points where appropriate **
************************************************** **********************
  #7  
Old 18th September 2007, 17:46
m80arm's Avatar
m80arm m80arm is offline
Moderator
 
 Join Date: Apr 2005
  6 month star 12 month star
 Location: Newcastle, UK
 Posts: 2,633
  Send a message via MSN to m80arm Send a message via Skype™ to m80arm
 Reputation: m80arm is just really nicem80arm is just really nicem80arm is just really nicem80arm is just really nice (354)
Default Re: Script to change permissions on a System32 file

Quote:
Originally Posted by biggles77 View Post
(I am annoyed I had forgotten about Xcalcs though).
Old age will do that to you

Soon you'll forget that you owe me £1000 - Actually, it might have happened already

Michael
__________________
Michael Armstrong
www.m80arm.co.uk
MCITP: EA, MCTS, MCSE 2003, MCSA 2003: Messaging, CCA, VCP 3.5, 4, 5, VCAP5-DCD, VCAP5-DCA, ITIL, MCP, PGP Certified Technician

** Remember to give credit where credit is due and leave reputation points To grant some reputation points to the user that helped you, just click on the little Yin-Yang icon on the right of the user's answer and follow the prompt. where appropriate **
  #8  
Old 18th September 2007, 18:56
biggles77's Avatar
biggles77 biggles77 is offline
Administrator
 
 Join Date: Dec 2003
  6 month star 12 month star
 Location: Nowhere that I like.
 Posts: 10,758
 Reputation: biggles77 is a splendid one to beholdbiggles77 is a splendid one to beholdbiggles77 is a splendid one to beholdbiggles77 is a splendid one to beholdbiggles77 is a splendid one to beholdbiggles77 is a splendid one to beholdbiggles77 is a splendid one to behold (734)
Default Re: Script to change permissions on a System32 file

Quote:
Originally Posted by m80arm View Post
Old age will do that to you

Soon you'll forget that you owe me £1000 - Actually, it might have happened already

Michael
And I won't forget how you said you got sore fingers playing with yourself........on your guitar?
__________________
"There I stood at the bar, wearing a Mae West, no jacket, and beginning to leak blood from my torn boot. None of the golfers took any notice of me - after all, I wasn't a member!" Kenneth Lee - after being shot down during the Battle of Britain on the 18th August 1940.

************************************************** **********************
** Remember to give credit where credit is due and leave reputation points where appropriate **
************************************************** **********************
Closed Thread


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
change file name to date with script poly General Scripting 6 3rd September 2007 17:34
put a file in %windir%\system32 wolfgang General Scripting 2 27th April 2007 18:33
Reassigning permissions on File server via script jessshouse General Scripting 5 16th November 2006 22:16
Permissions on %systemroot%\system32\GroupPolicy jachin84 GPO 2 16th January 2006 10:25
Script to change Diretory and File Permissions dlucas10 General Scripting 1 17th November 2005 08:32


All times are GMT +3. The time now is 08:29.

Steel Blue 3.5.4 vBulletin Style ©2006 vBEnhanced
Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
 

Valid XHTML 1.0!   Valid CSS!

Copyright 2005 Daniel Petri