Solved

Script to backup file permissions on all drives

Posted on 2011-09-23
3
300 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
  • 2
3 Comments
 
LVL 10

Accepted Solution

by:
ReneGe earned 500 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

[Webinar] Disaster Recovery and Cloud Management

Learn from Unigma and CloudBerry industry veterans which providers are best for certain use cases and how to lower cloud costs, how to grow your Managed Services practice in IaaS clouds, and how to utilize public cloud for Disaster Recovery

Question has a verified solution.

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

Are you one of those front-line IT Service Desk staff fielding calls, replying to emails, all-the-while working to resolve end-user technological nightmares? I am! That's why I have put together this brief overview of tools and techniques I use in o…
A brief introduction to what I consider to be the best editor for PowerShell.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

895 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now