Announcement

Collapse
No announcement yet.

Script to change permissions on a System32 file

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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.
    1 1 was a racehorse.
    2 2 was 1 2.
    1 1 1 1 race 1 day,
    2 2 1 1 2

  • #2
    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.

    Comment


    • #3
      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 sigpic where appropriate **

      Comment


      • #4
        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

        Comment


        • #5
          Re: Script to change permissions on a System32 file

          summarised:
          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, 12:57.

          This posting is provided "AS IS" with no warranties, and confers no rights.

          __________________

          ** Remember to give credit where credit's due **
          and leave Reputation Points for meaningful posts

          Comment


          • #6
            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).
            1 1 was a racehorse.
            2 2 was 1 2.
            1 1 1 1 race 1 day,
            2 2 1 1 2

            Comment


            • #7
              Re: Script to change permissions on a System32 file

              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 sigpic where appropriate **

              Comment


              • #8
                Re: Script to change permissions on a System32 file

                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?
                1 1 was a racehorse.
                2 2 was 1 2.
                1 1 1 1 race 1 day,
                2 2 1 1 2

                Comment

                Working...
                X