In 2009 I wrote a small wrapper to play with the Libraries functionality in Windows 7. This was in response to a customers need. I uploaded the version to Codeplex, but to be honest I did not maintain it on Codeplex– even though I updated it for my customers need.
Yesterday I got an email from Ed Wilson – the scripting guy at Microsoft – and he was playing around with it. This got me thinking about the project again, and I realized the version on codeplex where not updated.
Today I uploaded version 0.5 beta to Codeplex, and I think it has some nice enhancements. I even added comment based help after a small tip from Ed So, thanks Ed!
First of all – what is Windows7Library?
Windows7Library is a Powershell 2.0 module that lets you manage the libraries introduced with Windows 7. You can add libraries, as well as folders to the libraries. You can set the default folder for an library (meaning the default save location if just the library is specified). You can also remove the folders from the Library.
You can download the files from Codeplex : Windows7Library.zip
Short install guide:
(Extract to one of your folders given in $ENV:PSModulePath to simplify usage.)
- Steps to install to your Modules folder:
Extract content from zip file to ~/documents/windowspowershell/modules/Windows7Library
If you don`t have the Modules folder in your WindowsPowershell folder, just create it. - From inside your Powershell session type the following command:
Import-Module Windows7Library
PLEASE NOTE
If this fails, please check that you allow scripts to run. If you demand Signed scripts, this script is not signed.
Also note that you might have to Unblock the file (as the file is downloaded from the Internet).
This should be done on the file Windows7Library.psm1 that you just extracted. (Right-Click the file, Properties and Unblock)
The commands inside the module is:
- Get-Library
- Add-Library
- Get-LibraryFolder
- Set-LibraryFolder
- Add-LibraryFolder
- Remove-LibraryFolder
- Get-KnownFolder
How to use?
Get-KnownFolder
To see all the knownfolders:
Get-KnownFolder –list
To get the path to the Documents Library
(Get-KnownFolder Documents).Path
Get-Library
To read the Documents Library object:
$library=Get-Library -LibraryName Documents
Your could now play with the Library object:
$library | get-member
Get-LibraryFolder
Returns a list of the defined library folders
Get-LibraryFolder -LibraryName Documents
Add-LibraryFolder
Adds an folder to the library
Add-LibraryFolder -LibraryName Documents -FolderPath \\server\share\folder
Remove-LibraryFolder
Removes an defined library folder
Remove-LibraryFolder -LibraryName Documents -FolderPath \\server\share\folder
Set-LibraryFolder
Set-LibraryFolder lets you define the default save folder for the library (note that the folder must be included in the library)
Set-LibraryFolder -LibraryName Documents -DefaultSaveFolder "c:\docs"
Add-Library
With Add-Library you could create your own Libraries
Add-Library -Name "My Own Library"
As you play around with it – let me know of suggestions or updates you make
Have fun!
you will like dvd to mov to take huge discount
Posted by: dumeurow | 02/09/2012 at 09:53 AM