This topic contains 2 replies, has 2 voices, and was last updated by
June 7, 2014 at 3:05 pm #16023ParticipantPoints: 0Rank: Member
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?
June 7, 2014 at 7:50 pm #16024ParticipantPoints: 0Rank: Member
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: http://stackoverflow.com/questions/8354443/create-ishelllibrary-instance-in-powershell
Where they talk about the IShellLibrary methods ( http://msdn.microsoft.com/en-us/library/windows/desktop/dd391719%28v=vs.85%29.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 : http://www.leeholmes.com/blog/2009/01/19/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 ( http://kevinjmorse.ca/articles/configuring-windows-7-libraries-using-group-policy-preferences ).
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.
June 8, 2014 at 11:51 pm #16040ParticipantPoints: 0Rank: Member
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.
The topic ‘Windows 7 Libraries’ is closed to new replies.