Scripting the Creation of Windows 7 Libraries

Firstly: happy new year!  Secondly: yes I know this is about Windows 7 but there are still plenty of Windows 7 desktops out there!  I haven’t tested this on Windows 8.x yet, so if you do please let me know how it goes 🙂

Ever since Windows 7 was first released in Beta, one of the common gripes amongst the techies doing deployment projects was how to automate through scripting, and therefore MDT, the creation/modification of the Windows 7 Libraries.  I’ve seen a few different solutions but they were all rather ugly as they involved hacking the registry using a process discovered (no idea by who) through trial-and-error. I never liked these hacks so would always steer customers well away from them (as well as towing the Microsoft line of “this is an unsupported method” etc.).

Well, fret no more, because it seems that Microsoft finally got round to creating such a tool – and even published the source code for it!  You can find the MSDN documentation for SHLIB.exe here: http://msdn.microsoft.com/library/dd940379

Here are the usage instructions for it: shlib.exe SUBCOMMAND

Supported commands:

create   –   Creates a library at the specified path.
info   –   Prints info about the given library.
enum   –   Enumerates the folders in the library.
setattrib   –   Modifies the attributes of the library.
add   –   Adds the specified folder to the specified library.
remove   –   Removes the specified folder from the library.
setsaveloc   –   Sets the default save location of the library.
resolve   –   Resolves the specified folder in the library.
resolveall   –   Resolves all locations in the library in bulk.
manage   –   Displays the Manage Library Dialog for the library.

By the way, Raymond Chen also blogged about it here: http://blogs.msdn.com/b/oldnewthing/archive/2012/08/28/10343980.aspx

Advertisements

3 thoughts on “Scripting the Creation of Windows 7 Libraries

  1. I’d been using this method on Windows 7 systems for a couple of years with no problems. On WIndows 8 though, a) Libraries are deprecated (they still exist, but not shown by default), and b) I’ve had some bugginess noted, especially when creating a library (the library def file wouldn’t create properly)

Speak your mind...

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s