Hi
I am using below script to export the permission from share folders.
=============
$a = (Get-Acl -Path '\\server1\depts')
$a.Access | Select-Object FileSystemRights, AccessControlType, IdentityReference, IsInherited | Export-Csv c:\deptsPermission.csv -NoTypeInformation
$a = (Get-Acl -Path '\\server2\Databases')
$a.Access | Select-Object FileSystemRights, AccessControlType, IdentityReference, IsInherited | Export-Csv c:\server2Permission.csv -NoTypeInformation
$a = (Get-Acl -Path '\\fileserver\Apps')
$a.Access | Select-Object FileSystemRights, AccessControlType, IdentityReference, IsInherited | Export-Csv c:\Apps.csv -NoTypeInformation
=============
The output files are generating seprately with name (deptspermission.csv, server2permission.csv and apps.csv)
Now I want all three csv file (deptspermission.csv, server2permission.csv and apps.csv) club in one CSV file, not in different different CSV file.
Now I am using below script to send mail for all three different CSV file.
# Email Variables
$emailsmtpServer = "smtp.mail.org"
$emailto = "myname@mail.org"
$emailfrom = "permission@mail.org"
$emailsubject = "permission"
$emailattachments = "c:\deptspermission.csv","c:\server2permission.csv","c:\apps.csv"
$emailbody = @"
Dear Team
"@
Send-MailMessage -To $emailto -From $emailfrom -Subject $emailsubject -Body $emailbody Attachments $emailattachments -SmtpServer $emailsmtpServer
So If I can get the all share folder permission in one CSV files then it would be great help for me
I am using below script to export the permission from share folders.
=============
$a = (Get-Acl -Path '\\server1\depts')
$a.Access | Select-Object FileSystemRights, AccessControlType, IdentityReference, IsInherited | Export-Csv c:\deptsPermission.csv -NoTypeInformation
$a = (Get-Acl -Path '\\server2\Databases')
$a.Access | Select-Object FileSystemRights, AccessControlType, IdentityReference, IsInherited | Export-Csv c:\server2Permission.csv -NoTypeInformation
$a = (Get-Acl -Path '\\fileserver\Apps')
$a.Access | Select-Object FileSystemRights, AccessControlType, IdentityReference, IsInherited | Export-Csv c:\Apps.csv -NoTypeInformation
=============
The output files are generating seprately with name (deptspermission.csv, server2permission.csv and apps.csv)
Now I want all three csv file (deptspermission.csv, server2permission.csv and apps.csv) club in one CSV file, not in different different CSV file.
Now I am using below script to send mail for all three different CSV file.
# Email Variables
$emailsmtpServer = "smtp.mail.org"
$emailto = "myname@mail.org"
$emailfrom = "permission@mail.org"
$emailsubject = "permission"
$emailattachments = "c:\deptspermission.csv","c:\server2permission.csv","c:\apps.csv"
$emailbody = @"
Dear Team
"@
Send-MailMessage -To $emailto -From $emailfrom -Subject $emailsubject -Body $emailbody Attachments $emailattachments -SmtpServer $emailsmtpServer
So If I can get the all share folder permission in one CSV files then it would be great help for me