Remove-Share

The command deletes a share on a Windows computer. Existing connections are disconnected. The share can be located locally (on the computer where the command is executed) or on a remote computer (remote share).


Settings:

  • Server name
    Machine on which the share is to be deleted. To remove the share on the computer running the script, use the name localhost. If you specify the name of a remote computer, WinRM must be enabled on that computer and the account used to run the script must have the appropriate privileges to delete the share.
  • Share name
    Name of the share to be removed.


Example:

In the following example, the sources$ share is deleted on the local machine.


Corresponds to DSM eScript command:

  • DeleteShare


See also: