Windows 7 Libraries

Hello everyone,

I am new to Powershell and would appreciate some help. Currently I am trying to manipulate Windows 7 libraries using Powershell. I would like to be able to perform basic tasks like create/delete a library, add and remove folders to it and also to list any folders that are part of one. I have been doing some research and found out that PS does not have default commands to manage them.

I was able to create a library by simply taking the xml code of a previous one and using that as a building block (using new-item) but I do not think this is a very good approach. Any suggestions?

Thanks!

I found this interesting so I went poking around figuring there had to be some .NET-ish methods to get to it.

Researching I was able to find this on StackExchange: windows - Create IShellLibrary instance in PowerShell - Stack Overflow
Where they talk about the IShellLibrary methods ( http://msdn.microsoft.com/en-us/library/windows/desktop/dd391719(v=vs.85).aspx )
This mentions how it can get/add/remove folders so that should at least help out on that point, I also see there is an SHCreateLibrary function in there, so that maybe useful as well.

All the above just got me here : https://www.leeholmes.com/powershell-pinvoke-walkthrough/
and honestly that seems kind of messy.

It might just be easier to mess with the XML codes, placing the files in the correct location. Even looking at managing them through GPO mainly seems to be XML manipulation ( Configuring Windows 7 Libraries using Group Policy Preferences | Kevin J Morse.ca ).
They seem to be very boiler-plate XML, so with a few functions it seems reasonably manageable.

I know this is not the best reply, but I’m basically thinking out-loud and intrigued, so I figured I would at least share what I found so far, and continue looking around as well.

Thanks a lot for your input Raymond, it is much appreciated.

I was researching the ISHelllibrary on the MSDN link you provided and that seems to have all I need. However the code they have is C++ based, but I found that it is possible to execute C++ code within Powershell. All I have left now is to understand the C++ syntax to then use it in Powershell.

Thanks!