Announcement

Collapse
No announcement yet.

Change permission on a file on many PCs

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

  • Change permission on a file on many PCs

    I need to change permission on a particular file located on all the PCs on the domain. I created a batch file to change the permission but don't want to walk to each PCs to run the scirpt. Is it possible to do this remotely with Hyena?

    Many thanks.
    Mike

  • #2
    Re: Change permission on a file on many PCs

    Post the contents of your batch file and we'll see if we have any ideas.

    Comment


    • #3
      Re: Change permission on a file on many PCs

      Here is the exact script.

      IF NOT EXIST %Systemroot%\GPW_041.ini Copy N:\GPW04.1\GPW_041.ini %systemroot%\
      cacls %systemroot%\gpw_041.ini /e /g Users:f

      Comment


      • #4
        Re: Change permission on a file on many PCs

        What you should be able to do is create a Custom Tool under Tools->Settings->Tools, that looks like:

        cmd /x /c c:\batch_file.bat %E%

        Then modify your batch file with %1 in the places that you would want the computer name:

        IF NOT EXIST %1\%Systemroot%\GPW_041.ini

        Copy N:\GPW04.1\GPW_041.ini %1\%systemroot%\

        cacls %1\%systemroot%\gpw_041.ini /e /g Users:f

        Test it by right-clicking on a computer and running it. It that works, then you can select as many computers as you want in the right window and run against all of them.

        Comment


        • #5
          Re: Change permission on a file on many PCs

          The batch file gets the error "The filename, directory name, or volume label syntax is incorrect" when %1 is used.

          Command line
          -------------
          cmd /x /c c:\test.bat %E%
          (can I use UNC for the command line?)

          Batch file(test.bat)
          -----------------------
          IF NOT EXIST %1\%Systemroot%\GPW_041.ini Copy N:\GPW041\GPW_041.ini %1\%systemroot%\GPW_041.ini
          cacls %1\%systemroot%\gpw_041.ini /e /g Users:f


          Thanks.

          Comment


          • #6
            Re: Change permission on a file on many PCs

            Sorry, change the %1 to \\%1.

            Also, put a pause at the end of your batch file so you can see what it is translating it to.

            Comment


            • #7
              Re: Change permission on a file on many PCs

              Getting network path was not found.

              C:\>IF NOT EXIST \\ComputerName\C:\WINNT\GPW_041.ini Copy N:\GPW04.1\GPW_041.ini \\ComputerName\C:\WINNT\GPW_041.ini
              The network path was not found.
              0 file(s) copied.

              C:\>cacls \\ComputerName\C:\WINNT\gpw_041.ini /e /g Users:f
              The network path was not found.

              C:\>pause
              Press any key to continue . . .


              Thanks.

              Comment


              • #8
                Re: Change permission on a file on many PCs

                Change your paths to UNC paths:

                \\computer\c$

                Comment


                • #9
                  Re: Change permission on a file on many PCs

                  Finally work after making certain tweaking.


                  Command line
                  -------------
                  cmd /x /c \\Server\Share\test.bat %E%


                  test.bat
                  --------
                  IF NOT EXIST \\%1\C$\Winnt\GPW_041.ini Copy \\Server\Share\Gpw_041.ini \\%1\C$\Winnt\Gpw_041.ini
                  cacls \\%1\c$\Winnt\\gpw_041.ini /e /g Users:f

                  Thank you for your help!

                  Regards,
                  Mike

                  Comment


                  • #10
                    Re: Change permission on a file on many PCs

                    I am a die hard Hyena user myself, but I had to add this small bit. If you have an active directory. You can go into the GPO, edit the computer configuration > Windows Setting's > Security Setting's > File System. You can add any folder you want and set the permissions. Then it will propagate down to all the PC's within the OU.

                    Comment

                    Working...
                    X
                    😀
                    🥰
                    🤢
                    😎
                    😡
                    👍
                    👎