{"id":1714,"date":"2014-03-31T00:01:00","date_gmt":"2014-03-31T00:01:00","guid":{"rendered":"https:\/\/blogs.technet.microsoft.com\/heyscriptingguy\/2014\/03\/31\/introduction-to-powershell-endpoints\/"},"modified":"2014-03-31T00:01:00","modified_gmt":"2014-03-31T00:01:00","slug":"introduction-to-powershell-endpoints","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/scripting\/introduction-to-powershell-endpoints\/","title":{"rendered":"Introduction to PowerShell Endpoints"},"content":{"rendered":"<p><b>Summary<\/b>: Learn about Windows PowerShell endpoints and how they relate to remoting.<\/p>\n<p><img decoding=\"async\" alt=\"Hey, Scripting Guy! Question\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/q-for-powertip.jpg\" \/>&nbsp;Hey, Scripting Guy! I keep hearing about Windows PowerShell endpoints and constrained endpoints related to remote management. Can you tell me more about these?<\/p>\n<p>&mdash;KP<\/p>\n<p><img decoding=\"async\" alt=\"Hey, Scripting Guy! Answer\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/a-for-powertip.jpg\" \/>&nbsp;Hello, KP.&nbsp;Honorary Scripting Guy, Boe Prox, here today filling in for my good friend, The Scripting Guy. Here&#039;s a bit about me:<\/p>\n<p style=\"margin-left:30px\">Boe Prox is a Microsoft MVP in Windows PowerShell and a senior Windows system administrator. He has worked in the IT field since 2003, and he supports a variety of different platforms. He is a contributing author in <a href=\"http:\/\/manning.com\/hicks\">PowerShell Deep Dives<\/a> with chapters about WSUS and TCP communication. He is a moderator on the <a href=\"http:\/\/social.technet.microsoft.com\/Forums\/scriptcenter\/en-US\/home?forum=ITCG\">Hey, Scripting Guy! forum<\/a>, and he has been a judge for the Scripting Games since 2010. He recently presented talks on the topic of WSUS and PowerShell at the <a href=\"http:\/\/mspsug.com\/2013\/09\/17\/video-and-presentation-materials-from-the-september-mspsug-meeting\/\">Mississippi PowerShell User Group<\/a>. He is an Honorary Scripting Guy, and he has submitted a number of posts as a guest blogger, which discuss a variety of topics. To read more, see these <a href=\"\/b\/heyscriptingguy\/archive\/tags\/boe+prox\/\">Hey, Scripting Guy! Blog posts<\/a>.<\/p>\n<p style=\"margin-left:30px\">Boe&rsquo;s blog: <a href=\"http:\/\/learn-powershell.net\/\">Learn Powershell |Achieve More<br \/><\/a>CodePlex projects: <a href=\"http:\/\/poshwsus.codeplex.com\/\">PoshWSUS<\/a>, <a href=\"http:\/\/poshpaig.codeplex.com\/\">PoshPAIG<\/a>, <a href=\"http:\/\/poshchat.codeplex.com\/\">PoshChat<\/a>, and <a href=\"http:\/\/posheventui.codeplex.com\/\">PoshEventUI<\/a><\/p>\n<p>This is the first part in a series of five posts about Remoting Endpoints. The series includes:<\/p>\n<ol>\n<li><b><\/b><b>Introduction to PowerShell Endpoints<\/b><\/li>\n<li><a href=\"https:\/\/devblogs.microsoft.com\/scripting\/build-constrained-powershell-endpoint-using-startup-script\/\">Build Constrained PowerShell Endpoint Using Startup Script<\/a><\/li>\n<li><a href=\"https:\/\/devblogs.microsoft.com\/scripting\/build-constrained-powershell-endpoint-using-configuration-file\/\">Build Constrained PowerShell Endpoint Using Configuration File<\/a><\/li>\n<li><a href=\"https:\/\/devblogs.microsoft.com\/scripting\/use-delegated-administration-and-proxy-functions\/\">Use Delegated Administration and Proxy Functions<\/a><\/li>\n<li><a href=\"https:\/\/devblogs.microsoft.com\/scripting\/build-a-tool-that-uses-constrained-powershell-endpoint\/\">Build a Tool that Uses Constrained PowerShell Endpoint<\/a><\/li>\n<\/ol>\n<p>When performing a variety of tasks, system administrators can leverage Windows PowerShell remoting to connect to remote systems and run commands as though they were logged directly into the server. Remoting has been available since Windows PowerShell&nbsp;2.0, which means that it goes as far back as Windows Server&nbsp;2003. Prior to Windows Server&nbsp;2012, you had to manually enable PSRemoting to provide the necessary configuration to grant access to each server. In Windows Server&nbsp;2012, Windows PowerShell remoting is already enabled and ready to go.<\/p>\n<p>Administrators do nothing more than connect to a remote session or issue commands from a single workstation against multiple remote systems (known as &ldquo;fan-out&rdquo;), and they leverage Windows PowerShell Remoting to accomplish this.<\/p>\n<p>When connecting to a Windows PowerShell endpoint or using <b>Invoke-Command<\/b>, you are connecting to a remote session configuration (an endpoint) where, depending on the configuration of the endpoint, you have a certain level of access to that remote system. I am going to take you through what an endpoint is, show various properties, and provide examples of a couple different types of endpoints that show how they affect the session.<\/p>\n<p>An endpoint is a set of configurations on a computer that help customize the environment when a user connects to the endpoint from a remote computer. Sessions that offer fewer cmdlets, functions, and other language features that you normally see when using Windows PowerShell are called <b>constrained endpoints<\/b>. This means that the sessions are tightened up to prevent unauthorized use of commands that could potentially cause harm, or to prevent commands from being run accidently. These can be used to provide a means to run certain commands by a junior system administrator or a service desk.<\/p>\n<p>Following is an example of connecting to a remote system and running a couple of commands:<\/p>\n<p style=\"margin-left:30px\">PS C:\\&gt; Enter-PSSession -ComputerName DC1<\/p>\n<p style=\"margin-left:30px\">[DC1]: PS C:\\&gt; $env:Computername<\/p>\n<p style=\"margin-left:30px\">[DC1]: PS C:\\&gt; Get-Process | Sort WS -Descending | Select -First 5<\/p>\n<p style=\"margin-left:30px\">[DC1]: PS C:\\&gt; Exit-PSSession<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/IntroEndpoint1.png\"><img decoding=\"async\" title=\"Image of command output\" alt=\"Image of command output\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/IntroEndpoint1.png\" \/><\/a><\/p>\n<p>Starting with Windows PowerShell&nbsp;3.0, there are typically the following built-in endpoints:<\/p>\n<ul>\n<li>microsoft.powershell (standard endpoint)<\/li>\n<li>microsoft.powershell32 (optional if running a 64-bit operating system)<\/li>\n<li>microsoft.powershell.workflow<\/li>\n<li>microsoft.windows.servermanagerworkflows<\/li>\n<\/ul>\n<p>You can see all of your available endpoints by running <b>Get-PSSessionConfiguration<\/b>.<\/p>\n<p style=\"margin-left:30px\"><b>Note<\/b> You must run this command as an Administrator. You can only run this locally and not in a remote session (you will get an Access Denied error).<\/p>\n<p style=\"margin-left:30px\">PS C:\\&gt; Get-PSSessionConfiguration<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/IntroEndpoint2.png\"><img decoding=\"async\" title=\"Image of command output\" alt=\"Image of command output\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/IntroEndpoint2.png\" \/><\/a><\/p>\n<p>In its current default list view, we can see the names of each of the configuration session settings in addition to seeing if the session uses a startup script, and what version of Windows PowerShell will be used with the session. Also note the <b>Permission<\/b> property. This shows who has access to the remote session. In Windows PowerShell&nbsp;4.0, <b>Remote Management Users<\/b> was added as a group for session configuration access.<\/p>\n<p>My example of remoting into a server did not specify a session configuration name, but it did use <b>Microsoft.powershell<\/b> by default. Let&rsquo;s take a closer look at this configuration to see some of the settings and take a look at what they mean.<\/p>\n<p style=\"margin-left:30px\">PS C:\\&gt; Get-PSSessionConfiguration -Name microsoft.powershell | Select *<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/IntroEndpoint3.png\"><img decoding=\"async\" title=\"Image of command output\" alt=\"Image of command output\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/IntroEndpoint3.png\" \/><\/a><\/p>\n<p>Beyond what we have already seen with the default list view of the configuration sessions, we can also see a couple of other settings that are worth noting:<\/p>\n<ul>\n<li><b>SecurityDescriptorSddl<br \/> <\/b>This is the Security Descriptor Description Language (sddl), which is the non-human readable representation of the <b>Permission<\/b> property. If you are planning to script session configurations, this is where you would go to apply the proper permissions for the configuration.<b><\/b><\/li>\n<li><b>URI<br \/> <\/b>This is the Uniform Resource Identifier (URI) that you can connect to on the remote system.<\/li>\n<li>&nbsp;<b>RunAsUser<\/b> and <b>RunAsPassword<br \/> <\/b>These are used to provide delegated administration. More about this will be discussed in the coming days.<\/li>\n<\/ul>\n<p>I mentioned earlier about constrained sessions, which are typically custom created. We can see what those look like in the same way. A custom session configuration resides in a configuration file (.pssc), which resides on the remote server.<\/p>\n<p style=\"margin-left:30px\">PS C:\\&gt; Get-PSSessionConfiguration -Name ExampleSession | Select *<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/IntroEndpoint4.png\"><img decoding=\"async\" title=\"Image of command output\" alt=\"Image of command output\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/IntroEndpoint4.png\" \/><\/a><\/p>\n<p>Many of the same properties that were in the built-in endpoints are here in the custom endpoint. One is the location of the .pssc file that the session configuration references. Other points of metadata include CompanyName, Description, and Copyright.<\/p>\n<p>Different from the built-in configuration is the <b>Language<\/b> property, which dictates the language features that are available to the user when they are in the remote session. In this case, <b>FullLanguage<\/b> is available, which is what you see in a typical Windows PowerShell console session. Other options that are available for <b>LanguageMode<\/b> are:<\/p>\n<table border=\"1\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td width=\"169\" valign=\"top\">\n<p><b>NoLanguage<\/b><\/p>\n<\/td>\n<td width=\"469\" valign=\"top\">\n<p>Users can run commands, but they cannot use any language elements.<\/p>\n<p>&nbsp;<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td width=\"169\" valign=\"top\">\n<p><b>ConstrainedLanguage<\/b><\/p>\n<\/td>\n<td width=\"469\" valign=\"top\">\n<pre>Permits all Windows cmdlets and all Windows PowerShell language elements, but it limits permitted types.<\/pre>\n<pre>&nbsp;<\/pre>\n<\/td>\n<\/tr>\n<tr>\n<td width=\"169\" valign=\"top\">\n<p><b>RestrictedLanguage<\/b><\/p>\n<\/td>\n<td width=\"469\" valign=\"top\">\n<pre>Users can run commands (cmdlets, functions, CIM commands, and workflows), but they are not permitted to use script blocks. Only the following proxy functions are available to use: <b>Get-Command<\/b>, <b>Get-FormatData<\/b>, <b>Select-Object<\/b>, <b>Get-Help<\/b>, <b>Measure-Object<\/b>, <b>Exit-PSSession<\/b>, <b>Out-Default<\/b>.<\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>You can find more information about Windows PowerShell languages in the TechNet Library at <a href=\"http:\/\/technet.microsoft.com\/en-us\/library\/dn433292.aspx\" target=\"_blank\">about _Language_Modes<\/a>.<\/p>\n<p>In the end, when you connect to a constrained endpoint, you will see that certain features are not allowed. For instance, let&rsquo;s say that I am given two cmdlets to use (besides the proxy functions required for the remote session), and I have no access to any .NET types:<\/p>\n<p style=\"margin-left:30px\">PS C:\\&gt; Enter-PSSession -ComputerName &#039;boe-pc&#039; -ConfigurationName ExampleSession<\/p>\n<p style=\"margin-left:30px\">[boe-pc]: PS&gt;Get-WmiObject -Class Win32_Service<\/p>\n<p style=\"margin-left:30px\">[boe-pc]: PS&gt;[datetime]&#039;03\/01\/2014&#039;<\/p>\n<p style=\"margin-left:30px\">[boe-pc]: PS&gt;Get-Command<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/IntroEndpoint5.png\"><img decoding=\"async\" title=\"Image of command output\" alt=\"Image of command output\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/IntroEndpoint5.png\" \/><\/a><\/p>\n<p>KP, tomorrow I will talk about how to use a startup script to configure a constrained endpoint much like what I have just shown. Remoting Endpoint Week will continue tomorrow when I will talk about writing a startup script for a constrained endpoint.<\/p>\n<p>I invite you to follow the Scripting Guys on <a href=\"http:\/\/bit.ly\/scriptingguystwitter\" target=\"_blank\">Twitter<\/a> and <a href=\"http:\/\/bit.ly\/scriptingguysfacebook\" target=\"_blank\">Facebook<\/a>. If you have any questions, send email to me at <a href=\"mailto:scripter@microsoft.com\" target=\"_blank\">scripter@microsoft.com<\/a>, or post your questions on the <a href=\"http:\/\/bit.ly\/scriptingforum\" target=\"_blank\">Official Scripting Guys Forum<\/a>. See you tomorrow.<\/p>\n<p><b>Boe Prox, Honorary Scripting Guy<\/b>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Summary: Learn about Windows PowerShell endpoints and how they relate to remoting. &nbsp;Hey, Scripting Guy! I keep hearing about Windows PowerShell endpoints and constrained endpoints related to remote management. Can you tell me more about these? &mdash;KP &nbsp;Hello, KP.&nbsp;Honorary Scripting Guy, Boe Prox, here today filling in for my good friend, The Scripting Guy. Here&#039;s [&hellip;]<\/p>\n","protected":false},"author":596,"featured_media":87096,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[162,496,56,57,45],"class_list":["post-1714","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-scripting","tag-boe-prox","tag-endpoint","tag-guest-blogger","tag-remoting","tag-windows-powershell"],"acf":[],"blog_post_summary":"<p>Summary: Learn about Windows PowerShell endpoints and how they relate to remoting. &nbsp;Hey, Scripting Guy! I keep hearing about Windows PowerShell endpoints and constrained endpoints related to remote management. Can you tell me more about these? &mdash;KP &nbsp;Hello, KP.&nbsp;Honorary Scripting Guy, Boe Prox, here today filling in for my good friend, The Scripting Guy. Here&#039;s [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/1714","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/users\/596"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/comments?post=1714"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/1714\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media\/87096"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media?parent=1714"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/categories?post=1714"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/tags?post=1714"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}