Powershell Script to Share a Folder, Set NTFS and Share Permissions and Make it a Virtual Directory in IIS

David Holland 1 Reputation point
2022-10-11T15:28:35.96+00:00

I am looking to create a share, set NTFS and Share Permissions and then make it a Virtual Directory in IIS.

This is something I repetitively do with my job, but all by hand.

Here are the current permissions:

c:\program files\landesk\managementsuite\ldlogon
FRM-EPMCORE-01\LANDesk Management Suite:(RX)
FRM-EPMCORE-01\LANDesk Management Suite:(OI)(CI)(IO)(GR,GE)
FRM-EPMCORE-01\LANDesk Administrators:(OI)(CI)(F)
BUILTIN\Administrators:(OI)(CI)(F)
NT AUTHORITY\SYSTEM:(OI)(CI)(F)
NT AUTHORITY\IUSR:(RX)
NT AUTHORITY\IUSR:(OI)(CI)(IO)(GR,GE)
Everyone:(RX)
Everyone:(OI)(CI)(IO)(GR,GE)
NT AUTHORITY\NETWORK SERVICE:(OI)(CI)(F)

I want the share permissions to be the same as the NTFS permissions.

So to clarify, I want to do the following:

  1. Create a Share (We'll call it Distribution) pointing to C:\Distribution
  2. Set Share Permissions and NTFS permissions as shown above
  3. Create a Virtual Directory in IIS named "Distribution" pointing to C:\Distribution

Huge thanks in advance to the guru that knows how to do this!

Windows for business Windows Server User experience PowerShell
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.