{"id":1741,"date":"2014-04-07T14:27:00","date_gmt":"2014-04-07T14:27:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/powershell\/2014\/04\/07\/whats-in-a-name-using-prefixes-in-powershell\/"},"modified":"2024-02-22T11:21:40","modified_gmt":"2024-02-22T19:21:40","slug":"whats-in-a-name-using-prefixes-in-powershell","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/powershell\/whats-in-a-name-using-prefixes-in-powershell\/","title":{"rendered":"What\u2019s in a name?  Using prefixes in PowerShell."},"content":{"rendered":"<div class=\"WordSection1\">\n<p>We\u2019ve talked about this in the past but it\u2019s time for a reminder.\u00a0 PowerShell uses prefixes in front of nouns to avoid name collisions.\u00a0 Imagine how many collisions there would be if people used the noun \u201cUSER\u201d directly.\u00a0 Instead, we have cmdlets *-ADUser, *-VPNUser, and *-RDUser.\u00a0 The use of the prefix avoids name collisions.\u00a0 When there is a name collision, the customer must specify the full name of the cmdlet.\u00a0 Did you know that the full name of Get-ADUser was actually ActiveDirectory\\Get-ADUser?\u00a0 How would you feel if you had to type that every time you wanted to invoke that command?<\/p>\n<p class=\"MsoNormal\">The use of prefixes also makes it easy to find related components.\u00a0 Look how easy it is to find all the PowerShell settings by searching for variables with the \u201cPS\u201d prefix:<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/powershell\/wp-content\/uploads\/sites\/30\/2014\/04\/3730.PSNameLarger.png\"><img decoding=\"async\" class=\"alignnone size-full wp-image-20319\" src=\"https:\/\/devblogs.microsoft.com\/powershell\/wp-content\/uploads\/sites\/30\/2014\/04\/3730.PSNameLarger.png\" alt=\"Image 3730 PSNameLarger\" width=\"991\" height=\"279\" srcset=\"https:\/\/devblogs.microsoft.com\/powershell\/wp-content\/uploads\/sites\/30\/2014\/04\/3730.PSNameLarger.png 991w, https:\/\/devblogs.microsoft.com\/powershell\/wp-content\/uploads\/sites\/30\/2014\/04\/3730.PSNameLarger-300x84.png 300w, https:\/\/devblogs.microsoft.com\/powershell\/wp-content\/uploads\/sites\/30\/2014\/04\/3730.PSNameLarger-768x216.png 768w\" sizes=\"(max-width: 991px) 100vw, 991px\" \/><\/a><\/p>\n<p class=\"MsoNormal\">It is important to use prefixes.\u00a0 There are two other rules you need to know:<\/p>\n<ol>\n<li>\n<div class=\"MsoNormal\">The prefix for PowerShell is \u201cPS\u201d.\u00a0 If you use the \u201cPS\u201d prefix, we can and will collide with you.<\/div>\n<\/li>\n<li>\n<div class=\"MsoNormal\">There are two scenarios where PowerShell will use generic nouns:\u00a0 When we cover a system resource (e.g. *-Process) or where we provide a pluggable framework for an area (e.g. Drives, Jobs, Events, etc.).<\/div>\n<\/li>\n<\/ol>\n<p class=\"MsoNormal\">Moving forward, we anticipate continuing to create modules, environment variables, file extensions, and other content types using the \u201cPS\u201d prefix and creating additional pluggable frameworks where we will use generic nouns.\nIf you don\u2019t use a prefix or use the PS prefix, you are setting yourself up for a collision.<\/p>\n<p class=\"MsoNormal\">\n<p class=\"MsoNormal\">We don\u2019t want to create naming conflicts \u2013 that\u2019s why we have insisted on the use of prefixes from the very early days on PowerShell and why we started using the \u201cPS\u201d prefix.<\/p>\n<h2>To Sum Up<\/h2>\n<p class=\"MsoNormal\">Use noun prefixes and avoid the \u201cPS\u201d prefix to deliver a great customer experience and minimize\/avoid name collisions.<\/p>\n<p class=\"MsoNormal\">\n<p class=\"MsoNormal\">Thanks,<\/p>\n<p class=\"MsoNormal\">\n<p class=\"MsoNormal\">Jeffrey Snover and John Slack<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>We\u2019ve talked about this in the past but it\u2019s time for a reminder.\u00a0 PowerShell uses prefixes in front of nouns to avoid name collisions.\u00a0 Imagine how many collisions there would be if people used the noun \u201cUSER\u201d directly.\u00a0 Instead, we have cmdlets *-ADUser, *-VPNUser, and *-RDUser.\u00a0 The use of the prefix avoids name collisions.\u00a0 When [&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":[210,248],"class_list":["post-1741","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-powershell","tag-jeffrey-snover","tag-powershell"],"acf":[],"blog_post_summary":"<p>We\u2019ve talked about this in the past but it\u2019s time for a reminder.\u00a0 PowerShell uses prefixes in front of nouns to avoid name collisions.\u00a0 Imagine how many collisions there would be if people used the noun \u201cUSER\u201d directly.\u00a0 Instead, we have cmdlets *-ADUser, *-VPNUser, and *-RDUser.\u00a0 The use of the prefix avoids name collisions.\u00a0 When [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/posts\/1741","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=1741"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/posts\/1741\/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=1741"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/categories?post=1741"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/tags?post=1741"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}