Deleting Only Unauthorized Shares
As part of Desired Configuration Maintenance (DCM), it is important to control the shares defined on a server or workstation. All shares should be approved and configured in a standard mechanism. If they are not authorized then they should be removed. Earlier in this chapter, you collected a list of the shares to define on your computer (WriteSharesToFile.ps1). Later, you compared the contents of the text file that is produced to the current configuration of the share, and printed the results (AuditUnauthorizedShares.ps1). However, to maintain the desired configuration of your server, you must remove all unauthorized shares. To do this, modify the AuditUnauthorizedShares.ps1 script to delete the unauthorized shares, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access