How to Disable a File Share on a server via a text file
Posted on 2014-11-07
I need to disable multiple file shares from users who are no longer in our organization. I have added all of the share names to a text file but need to set the text file so that the PowerShell Script can call it so that it can then remove all of the shares from the text file from the 1 share server name.
Not sure if I need the $ included in the usernames though since the actual share is restricted to usera$
Example of what is in the text file:
PS C:\> Remove-SmbShare -Name Files -CimSession SRV2K12RC
Are you sure you want to perform this action?
SRV2K12RC: Performing operation 'Remove-Share' on Target
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?]
Help (default is "Y"):