Script to compare Win folder permissions, identical structure?

lokiju

Lifer
May 29, 2003
18,526
5
0
Can someone point me maybe in the right direct for comparing folders and their subfolders permissions against an identical but other folder structure?

I have two volumes on one server 2003 server and while I'm confident the structure and contents are identical, I need to compare their permissions to see if there's any difference between the two.

Is there a non-pain in the ass way to do this?
 

lozina

Lifer
Sep 10, 2001
11,711
8
81
Permissions as in if you right clicked a folder, hit properties, opened the security tab? Those permissions?

I think you can do this relatively easily with a c# app.

Are the two volumes accessible from the same machine? i.e. the program can open both volumes and compare and contrast in real time?
 

lokiju

Lifer
May 29, 2003
18,526
5
0
Permissions as in if you right clicked a folder, hit properties, opened the security tab? Those permissions?

I think you can do this relatively easily with a c# app.

Are the two volumes accessible from the same machine? i.e. the program can open both volumes and compare and contrast in real time?

Yes permissions as in what's listed on the security tab for every folder and sub folder.

There is an identical structure for this situation on the same machine on different driver letters.
 

Modelworks

Lifer
Feb 22, 2007
16,240
7
76
Using powershell would be one easy way to do it

Run powershell in adminstrative tools.
Enable scripts
Code:
set-executionpolicy remotesigned
get drive security info and pipe it to a text file.
Code:
Dir | Get-ACL | format-list > C:\drive1.txt
Dir | Get-ACL | format-list > C:\drive2.txt
Then just compare the two files in a text editor.

If you need to do all files and folders then add -recurse like this
Code:
Dir -recurse | Get-ACL | format-list > C:\drive1.txt
 
Last edited:

lokiju

Lifer
May 29, 2003
18,526
5
0
Server 2003 doesn't have powershell and I'd prefer not to install on this box since it's a high production server that is fragile.
 

lokiju

Lifer
May 29, 2003
18,526
5
0
Any chance I could run it via Powershell from another server against this remote server even if it doesn't have it installed locally?
 

Modelworks

Lifer
Feb 22, 2007
16,240
7
76
Any chance I could run it via Powershell from another server against this remote server even if it doesn't have it installed locally?

Sure . Powershell does not need to be on the target. As long as the host running powershell can see the drives that is all that matters.
 

lokiju

Lifer
May 29, 2003
18,526
5
0
Sure . Powershell does not need to be on the target. As long as the host running powershell can see the drives that is all that matters.

Wow that was crazy easy.

Thanks a lot!

I just opened both outputs in WinMerge and it quickly identified the differences for me.
 

sourceninja

Diamond Member
Mar 8, 2005
8,805
65
91
Yea, powershell answered one of my biggest complaints about windows.

Now if they would just develop a better 'terminal' application for powershell to run in.....