Solved

Script to backup file permissions on all drives

Posted on 2011-09-23
3
299 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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

This script checks a path to see if a folder exists. If the folder does exist you will get output "The folder has previously been created. No action taken" If not it will create the folder. Then adds one user modify permission to the folder. It …
This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

747 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