{"id":9771,"date":"2006-08-30T19:52:00","date_gmt":"2006-08-30T19:52:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/powershell\/2006\/08\/30\/powershell-namespsaces\/"},"modified":"2019-02-18T13:21:24","modified_gmt":"2019-02-18T20:21:24","slug":"powershell-namespsaces","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/powershell\/powershell-namespsaces\/","title":{"rendered":"PowerShell Namespsaces"},"content":{"rendered":"<p class=\"MsoNormal\"><span>A summary of the Namespaces PowerShell defines and uses.<\/span><\/p>\n<p class=\"MsoNormal\"><span>&nbsp;<\/span><\/p>\n<p class=\"MsoNormal\"><span>System.Management.Automation<\/span><\/p>\n<p class=\"MsoNormal\"><span>System.Management.Automation serves as the root namespace for PowerShell.<span>&nbsp; <\/span>The namespace contains the types a developer would use to implement a Cmdlet.<\/span><\/p>\n<p class=\"MsoNormal\"><span>&nbsp;<\/span><\/p>\n<p class=\"MsoNormal\"><span>Sub-namespaces are defined for specific sections of the API that are used by specific types of developers.<\/span><\/p>\n<p class=\"MsoNormal\"><span>&nbsp;<\/span><\/p>\n<p class=\"MsoNormal\"><span>System.Management.Automation.Host<\/span><\/p>\n<p class=\"MsoNormal\"><span>System.Management.Automation.Host contains the types a developer&nbsp;would use to interact with the Host.<span>&nbsp; <\/span>The Host manages user interactions and creates the Runspace(s) in which scripts are executed.<\/span><\/p>\n<p class=\"MsoNormal\"><span>&nbsp;<\/span><\/p>\n<p class=\"MsoNormal\"><span>System.Management.Automation.CmdletProvider<\/span><\/p>\n<p class=\"MsoNormal\"><span>System.Management.Automation.CmdletProvider contains the types a developer would use to implement a CmdletProvider.<\/span><\/p>\n<p class=\"MsoNormal\"><span>&nbsp;<\/span><\/p>\n<p class=\"MsoNormal\"><span>System.Management.Automation.Runspaces<\/span><\/p>\n<p class=\"MsoNormal\"><span>System.Management.Automation.Runspaces contains the types a developer would use to&nbsp;create and manage a Runspace.<span>&nbsp; <\/span>A Runspace is the context in which a Cmdlet runs (the engine that actually manages&nbsp;a Cmdlet).<\/span><\/p>\n<p class=\"MsoNormal\"><span>&nbsp;<\/span><\/p>\n<p class=\"MsoNormal\"><span>The Microsoft.PowerShell namespace<\/span><\/p>\n<p class=\"MsoNormal\"><span>This namespace uses the System.Management.Automation APIs to implement the powershell.exe host and associated commands.<\/span><\/p>\n<p class=\"MsoNormal\"><span>&nbsp;<\/span><\/p>\n<p class=\"MsoNormal\"><span>The .Commands namespace<\/span><\/p>\n<p class=\"MsoNormal\"><span>Cmdlet classes (those types which implement Cmdlets) should be defined in a [YourNamespace].Commands namespace.<span>&nbsp; <\/span>This allows users of your API to distinguish those classes that implement Cmdlets (hence should not be called directly)&nbsp;from other portions of your API that should be called directly.<\/span><\/p>\n<p><span><\/p>\n<p class=\"MsoNormal\"><span><\/span>&nbsp;<\/p>\n<p class=\"MsoNormal\"><span>Note that CmdletProvider implementations (such as the filesystem CmdletProvider) are also defined in this namespace since these simply expose a new store to a set of common cmdlets.<\/span>&nbsp;<\/p>\n<p class=\"MsoNormal\"><\/span>&nbsp;<\/p>\n<p class=\"MsoNormal\"><span>In keeping with this convention there is a Microsoft.PowerShell.Commands namespace which contains the Cmdlets and CmdletProviders implemented by the PowerShell team.<\/span><\/p>\n<p class=\"MsoNormal\"><span><\/span>&nbsp;<\/p>\n<p class=\"MsoNormal\"><span><\/span><\/p>\n<p class=\"MsoNormal\"><span>The .Internal namespace<\/span><\/p>\n<p class=\"MsoNormal\"><span>The .Internal namespace contains anything that should be treated as &#8220;internal&#8221; but must remain public for technical reasons.&nbsp; For example&nbsp;a class which only has internal members and constructors but is used as a base class for a public class.<span>&nbsp; <\/span>Members of&nbsp;this namespace should not be used directly.<\/span><\/p>\n<p><span><\/p>\n<p class=\"MsoNormal\"><span><\/span>&nbsp;<\/p>\n<p><span><\/p>\n<p class=\"MsoNormal\"><span>Kenneth Hansen [MSFT]<\/span><\/p>\n<p class=\"MsoNormal\"><span>Windows PowerShell\/Aspen PM<\/span><\/p>\n<p class=\"MsoNormal\"><span><\/span>&nbsp;<\/p>\n<p class=\"MsoNormal\"><span><\/span>&nbsp;<\/p>\n<p><\/span><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>A summary of the Namespaces PowerShell defines and uses. &nbsp; System.Management.Automation System.Management.Automation serves as the root namespace for PowerShell.&nbsp; The namespace contains the types a developer would use to implement a Cmdlet. &nbsp; Sub-namespaces are defined for specific sections of the API that are used by specific types of developers. &nbsp; System.Management.Automation.Host System.Management.Automation.Host contains the [&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":[43],"class_list":["post-9771","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-powershell","tag-sdk"],"acf":[],"blog_post_summary":"<p>A summary of the Namespaces PowerShell defines and uses. &nbsp; System.Management.Automation System.Management.Automation serves as the root namespace for PowerShell.&nbsp; The namespace contains the types a developer would use to implement a Cmdlet. &nbsp; Sub-namespaces are defined for specific sections of the API that are used by specific types of developers. &nbsp; System.Management.Automation.Host System.Management.Automation.Host contains the [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/posts\/9771","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=9771"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/posts\/9771\/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=9771"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/categories?post=9771"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/tags?post=9771"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}