I started a GitHub repository to hold my functions.
This function takes a UNC pathed share name as an input. It then will parse the path and determine the server and the name of the share. It will then connect to the server hosting the share with a CIMInstance and removes the share by one of the methods discussed in my previous article. I have tested it against Windows Server 2012R2, Windows Server 2008R3 and Windows Server 2003. On 2008R2, I tested against servers with just PowerShell 2 and no remoting as well as 2008R2 with PowerShell 5 (WMF5). The 2003 server didn’t have PowerShell installed at all.
I have a number of TODO: tags in my script of shortfalls that I can see and want to address over time. But it works in its current state. I have been wanting to blog for a long time but I never felt I was ready or enough of an authority to contribute. I decided recently that I didn’t need to have a perfect function to get started. PowerShell is all about getting in there at the command line and starting to string commands together and when you find something that works, you put it into a script or a function so that you can reuse it. I have been writing basic functions for a long time and started doing Advanced Functions when I started reading the Toolmaking book. I had made a few “advanced” functions prior to this but I didn’t truly understand what I was doing. I was adapting someone else’s Advanced Function to my needs. I am still learning and will continue to do so as any good PowerShell scripter/developer should.
Check out my function and let me know your thoughts.