In a previous tip you learned how you can create ad-hoc shares using WMI. These shares persist until you remove them again. So if you'd like to clean up behind you, here is a one-liner that removes a share locally or remote:
PS> ([wmi]'\\Storage1\root\cimv2:Win32_Share="Hidden"').Delete()
Just replace "Hidden" with the name of the share you want to delete, and replace "storage1" with the name or IP address of the target system. If you want to delete a share on your local system, remove the server name altogether:
PS> ([wmi]'root\cimv2:Win32_Share="Hidden"').Delete()