speeddownloadfantastic.blogg.se

Powershell shared folder permissions
Powershell shared folder permissions





This is for shares that have multiple trustees. Note that there are multiple entries for some shares. The CSV file can then be opened in excel (or other programs such as notepad), and it should look something like this: My import script handles that, which I will talk about in my next post.

powershell shared folder permissions

I did this because on the import I wanted to find the user’s (trustee) SID and set it accordingly to whats already in the system. One change I did make was to remove SID from the export (* and the speed update at bottom of this post). The Export-CSV cmdlet does of the work by making the array into a CSV file. He uses the Win32_LogicalShareSecuritySetting to get the security descriptor, and then pipes the descriptor (for each share) into a section that add’s the info to an array.

powershell shared folder permissions

$sd = $shareSec.invokeMethod('GetSecurityDescriptor',$null,$null) $shareSec = gwmi Win32_LogicalShareSecuritySetting -filter "name='$($share.name)'" Yet, it took me a little bit to figure out exactly how the export script was working so I want to talk about that a little bit.īasically, the script uses the same methods I talked about in my previous post to get the info and permissions for each share: Most of my customization comes with the import script. MoW’s export script can be found here.Įven though MoW’s was done on a previous version of PowerShell, there wasn’t really much that I wanted to change about it.

powershell shared folder permissions

In this post, I am going to strictly talk about the export script, with another “import” post to follow. So, there were a few changes to be made as well as some of my own customization. The scripts are nearly 5 years old now, as they are at his old blog ( ), and were done on previous versions of PowerShell. (If you just want to see the scripts, look at the bottom of the current post for my export and look at the bottom of this post for my import).Īfter some searching, I found that MoW over at had done something along the lines that I was looking for. This would then be a 2 script deal, one to export the share info, and one to import. A couple of weeks ago I was searching for a way to do this so that if a file server has its OS corrupted, the iSCSI data store could be connected to another server and we could restore all the share info with permissions quickly. Building off my last post ( Using PowerShell to manipulate share permissions), it is possible to export share info into a CSV file to backup info for all the shares on a server.







Powershell shared folder permissions