?
Solved

Script to backup file permissions on all drives

Posted on 2011-09-23
3
Medium Priority
?
313 Views
Last Modified: 2012-05-12
I am going to be doing lots of work on our file servers over the weekend and it would be good to have backups of all the file permission on all servers.

Can anyone help me with a script that will

Create c:\temp (if it doesn't already exist)
Identify all the drive letters that are in use on the server
Use SubInAcl to backup the file permissions to C:\temp\%computername%_Driveletter_Date.txt

I can then add this as a computer startup script as all the servers will be rebooted before work starts!

Thanks

Aidan
0
Comment
Question by:aideb
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 10

Accepted Solution

by:
ReneGe earned 2000 total points
ID: 36594451
Here you go.

All you have left, is to do your SubInAcl command line.


@ECHO OFF

SETLOCAL enabledelayedexpansion

SET TempFolder=c:\Temp

IF NOT EXIST "%TempFolder%" MD "%TempFolder%"

FOR /F %%A IN ('WMIC logicaldisk where drivetype^=3 get caption ^| FINDSTR :') DO (
	SET DriveLetter=%%A
	SET DriveLetter=!DriveLetter::=!
	ECHO SubInAcl command line >"%TempFolder%\%computername%_!DriveLetter!_%Date%".txt
)


PAUSE

Open in new window

0
 
LVL 2

Author Closing Comment

by:aideb
ID: 36902148
Excellent will use this on our next migrations

Thanks!
0
 
LVL 10

Expert Comment

by:ReneGe
ID: 36903077
You'r welcome
0

Featured Post

Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A procedure for exporting installed hotfix details of remote computers using powershell
A brief introduction to what I consider to be the best editor for PowerShell.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question