{"id":17830,"date":"2008-12-23T07:51:13","date_gmt":"2008-12-23T15:51:13","guid":{"rendered":"http:\/\/devblogs.microsoft.com\/powershell\/?p=17830"},"modified":"2019-06-07T07:52:59","modified_gmt":"2019-06-07T15:52:59","slug":"more-advanced-functions-get-assembly-and-get-exportedtype","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/powershell\/more-advanced-functions-get-assembly-and-get-exportedtype\/","title":{"rendered":"More Advanced Functions \u2013 Get-Assembly and Get-ExportedType"},"content":{"rendered":"<p>Tyson Kopczynski has just published a great article <a href=\"http:\/\/www.networkworld.com\/community\/node\/36616\" mce_href=\"http:\/\/www.networkworld.com\/community\/node\/36616\">Fun with PowerShell 2.0 Eventing!<\/a>&nbsp; That inspired to to write a script to automatically backup my modules directory.&nbsp; I&#8217;m doing a lot of scripting this week and I don&#8217;t want to lose my work if I make a mistake.&nbsp; I thought I would write a scripting using PowerShell 2.0 Eventing to watch my directory and then make a backup copy automatically.<\/p>\n<p>The way to do this is with a FileSystem Watcher or something like that.&nbsp; Here is where the story changes and why the title of this blog is not &#8220;Backup Your Modules Automatically with PS V2 Eventing&#8221;.&nbsp; I couldn&#8217;t remember the name of the type to use.&nbsp; I was about to go code my traditional ad hoc script to find types and thought -1) why aren&#8217;t I automating this and 2) how many other people would be able to write this.&nbsp; With that, I decided to formalize my work a bit and share the results.&nbsp; Attached are Get-Assembly.PS1 and Get-ExportedType.ps1 and a Demo-GetExportedType.txt to walk you through a few examples.<\/p>\n<p>Enjoy!<\/p>\n<p>Jeffrey Snover [MSFT]   <br>Windows Management Partner Architect    <br>Visit the Windows PowerShell Team blog at:&nbsp;&nbsp;&nbsp; <a href=\"http:\/\/blogs.msdn.com\/PowerShell\" mce_href=\"http:\/\/blogs.msdn.com\/PowerShell\">http:\/\/blogs.msdn.com\/PowerShell<\/a>    <br>Visit the Windows PowerShell ScriptCenter at:&nbsp; <a href=\"http:\/\/www.microsoft.com\/technet\/scriptcenter\/hubs\/msh.mspx\" mce_href=\"http:\/\/www.microsoft.com\/technet\/scriptcenter\/hubs\/msh.mspx\">http:\/\/www.microsoft.com\/technet\/scriptcenter\/hubs\/msh.mspx<\/a><\/p>\n<p><a href=\"https:\/\/msdnshared.blob.core.windows.net\/media\/MSDNBlogsFS\/prod.evol.blogs.msdn.com\/CommunityServer.Components.PostAttachments\/00\/09\/25\/04\/46\/Get-ExportedType.zip\" original-url=\"http:\/\/blogs.msdn.com\/cfs-file.ashx\/__key\/communityserver-components-postattachments\/00-09-25-04-46\/Get_2D00_ExportedType.zip\">Get-ExportedType.zip<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Tyson Kopczynski has just published a great article Fun with PowerShell 2.0 Eventing!&nbsp; That inspired to to write a script to automatically backup my modules directory.&nbsp; I&#8217;m doing a lot of scripting this week and I don&#8217;t want to lose my work if I make a mistake.&nbsp; I thought I would write a scripting using [&hellip;]<\/p>\n","protected":false},"author":600,"featured_media":13641,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[97,137,167,173],"class_list":["post-17830","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-powershell","tag-advanced-functions","tag-ctp3","tag-get-assembly","tag-get-exportedtype"],"acf":[],"blog_post_summary":"<p>Tyson Kopczynski has just published a great article Fun with PowerShell 2.0 Eventing!&nbsp; That inspired to to write a script to automatically backup my modules directory.&nbsp; I&#8217;m doing a lot of scripting this week and I don&#8217;t want to lose my work if I make a mistake.&nbsp; I thought I would write a scripting using [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/posts\/17830","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/users\/600"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/comments?post=17830"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/posts\/17830\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/media\/13641"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/media?parent=17830"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/categories?post=17830"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/tags?post=17830"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}