More Advanced Functions – Get-Assembly and Get-ExportedType
Tyson Kopczynski has just published a great article Fun with PowerShell 2.0 Eventing! That inspired to to write a script to automatically backup my modules directory. I’m doing a lot of scripting this week and I don’t want to lose my work if I make a mistake. I thought I would write a scripting using PowerShell 2.0 Eventing to watch my directory and then make a backup copy automatically.
The way to do this is with a FileSystem Watcher or something like that. Here is where the story changes and why the title of this blog is not “Backup Your Modules Automatically with PS V2 Eventing”. I couldn’t remember the name of the type to use. I was about to go code my traditional ad hoc script to find types and thought -1) why aren’t I automating this and 2) how many other people would be able to write this. With that, I decided to formalize my work a bit and share the results. Attached are Get-Assembly.PS1 and Get-ExportedType.ps1 and a Demo-GetExportedType.txt to walk you through a few examples.
Jeffrey Snover [MSFT]
Windows Management Partner Architect
Visit the Windows PowerShell Team blog at: http://blogs.msdn.com/PowerShell
Visit the Windows PowerShell ScriptCenter at: http://www.microsoft.com/technet/scriptcenter/hubs/msh.mspx