{"id":4801,"date":"2009-01-06T15:57:00","date_gmt":"2009-01-06T15:57:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/powershell\/2009\/01\/06\/manage-winrm-settings-with-wsman-provider\/"},"modified":"2019-02-18T13:12:57","modified_gmt":"2019-02-18T20:12:57","slug":"manage-winrm-settings-with-wsman-provider","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/powershell\/manage-winrm-settings-with-wsman-provider\/","title":{"rendered":"Manage winrm settings with wsman provider"},"content":{"rendered":"<p class=\"MsoNormal\"><font face=\"Calibri\" size=\"3\">PowerShell remoting is built on top of Windows Remote Management (WinRM), which is Microsoft\u2019s implementation of WS-Management protocol. You can use winrm.cmd command line tool to query and manage winrm settings. PowerShell V2 CTP3 contains a wsman provider for you to manage winrm settings with the standard *-Item cmdlets . Let\u2019s try it out:<\/font><\/p>\n<p><span><font size=\"3\">PS C:\\&gt; cd wsman:<br \/>PS WSMan:\\&gt; dir<br \/><span>&nbsp;&nbsp; <\/span>WSManConfig: Microsoft.WSMan.Management\\WSMan::WSMan<br \/>ComputerName<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>Type<br \/>&#8212;&#8212;&#8212;&#8212;<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>&#8212;-<br \/>localhost<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>Container<br \/>PS WSMan:\\&gt; cd .\\localhost<br \/>PS WSMan:\\localhost&gt; dir | ft \u2013auto<br \/><span>&nbsp;&nbsp; <\/span>WSManConfig: Microsoft.WSMan.Management\\WSMan::localhost<br \/>Name<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>Value<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>Type<br \/>&#8212;-<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>&#8212;&#8211;<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>&#8212;-<br \/>MaxEnvelopeSizekb<span>&nbsp;&nbsp; <\/span>150<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>System.String<br \/>MaxTimeoutms<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>180000<span>&nbsp;&nbsp;&nbsp;&nbsp; <\/span>System.String<br \/>MaxBatchItems<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>32000<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>System.String<br \/>MaxProviderRequests 4294967295 System.String<br \/>Client<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span>Container<br \/>Service<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>Container<br \/>Shell<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>Container<br \/>Listener<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>Container<br \/>Plugin<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>Container<br \/>ClientCertificate<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>Container<\/font><\/p>\n<p class=\"MsoNormal\"><font face=\"Calibri\" color=\"#000000\" size=\"3\">At the top level of the wsman drive, you see a container named localhost, this contains all the winrm settings for the local computer. If you cd into localhost, you have six more containers (I put corresponding winrm command line in parentheses for your reference): client contains client side winrm settings ( winrm g winrm\/config\/client), service contains server side winrm settings (winrm<span>&nbsp; <\/span>g <span>&nbsp;<\/span>winrm\/config\/service), shell contains shell settings (winrm<span>&nbsp; <\/span>g winrm\/config\/winrs), listener contains listener instances (winrm e winrm\/config\/listener), plugin contains<span>&nbsp; <\/span>winrm plugin instances including the default microsoft.powershell plugin, and clientcertificate contains certificate mappings (winrm e winrm\/config\/service\/certmapping). The *-PSSessionConfiguration cmdlets were actually&nbsp;built on top of wsman provider. Let\u2019s try Remove-Item and New-Item on listener instances. Don\u2019t<span>&nbsp; <\/span>forget you can use tab completion to find out<span>&nbsp; <\/span>dynamic parameters of New-Item for specific path in wsman provider.<\/font><\/p>\n<p class=\"MsoNormal\"><span><font size=\"3\">PS WSMan:\\&gt; cd .\\localhost\\Listener<br \/>PS WSMan:\\localhost\\Listener&gt; Get-ChildItem<br \/><span>&nbsp;&nbsp; <\/span>WSManConfig: Microsoft.WSMan.Management\\WSMan::localhost\\Listener<br \/>Name<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>Type<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>Keys<br \/>&#8212;-<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>&#8212;-<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>&#8212;-<br \/>Listener_98910385<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>Container<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>{Address=*, Transport=HTTP}<br \/>PS WSMan:\\localhost\\Listener&gt; Remove-Item .\\Listener_98910385 \u2013Recurse<br \/>PS WSMan:\\localhost\\Listener&gt; New-Item . -Port 8080 -Address * -Transport http<br \/><span>&nbsp;&nbsp; <\/span>WSManConfig: Microsoft.WSMan.Management\\WSMan::localhost\\Listener<br \/>Name<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>Type<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>Keys<br \/>&#8212;-<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>&#8212;-<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>&#8212;-<br \/>Listener_98910385<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>Container<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>{Address=*, Transport=HTTP}<\/font><\/span><span><font size=\"3\">&nbsp;<\/font><\/span><\/p>\n<p><font><\/font><\/span>&nbsp;<font face=\"Calibri\" size=\"3\">Now let\u2019s use set-item to change server side <span>&nbsp;<\/span>winrm settings on a remote computer to allow CredSSP authentication. You can connect to remote winrm service using<span>&nbsp; <\/span>connect-wsman cmdlet, remote computer name will show up at the top level of the wsman drive if the connection is successful.<\/font><\/p>\n<p class=\"MsoNormal\"><span><font size=\"3\">PS WSMan:\\&gt; Enable-WSManCredSSP *<br \/>cfg<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>: <\/font><a href=\"http:\/\/schemas.microsoft.com\/wbem\/wsman\/1\/config\/client\/auth\"><span><font size=\"3\">http:\/\/schemas.microsoft.com\/wbem\/wsman\/1\/config\/client\/auth<\/font><\/span><\/a><br \/><font size=\"3\">lang<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>: en-US<br \/>Basic<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>: true<br \/>Digest<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>: true<br \/>Kerberos<span>&nbsp;&nbsp;&nbsp; <\/span>: true<br \/>Negotiate<span>&nbsp;&nbsp; <\/span>: true<br \/>Certificate : true<br \/>CredSSP<span>&nbsp;&nbsp;&nbsp;&nbsp; <\/span>: true<br \/>PS WSMan:\\&gt; New-PSSession weiwu-lh64.ntdev.corp.microsoft.com -cred $cred -Authentication credssp<br \/><\/font><\/span><span><font size=\"3\">[weiwu-lh64.ntdev.corp.microsoft.com] Connecting to remote server failed with the following error message : The WinRM client cannot process the request. The authentication mechanism requested by the client is not supported by the server or unencrypted traffic is disabled in the service configuration. Verify the unencrypted traffic setting in the service configuration or specify one of the authentication mechanisms supported by the server.<span>&nbsp; <\/span>To use Kerberos, specify the computer name as the remote destination. Also verify that the client computer and the destination computer are joined to a domain. To use Basic, specify the computer name as the remote destination, specify Basic authentication and provide user name and password. Possible authentication mechanisms reported by server:<span>&nbsp;&nbsp;&nbsp;&nbsp; <\/span>Negotiate Kerberos<br \/><span>&nbsp;&nbsp;&nbsp; <\/span>+ CategoryInfo<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>: OpenError: (System.Manageme&#8230;.RemoteRunspace:RemoteRunspace) [], PSRemotingTransportException<br \/><span>&nbsp;&nbsp;&nbsp; <\/span>+ FullyQualifiedErrorId : PSSessionOpenFailed<\/font><\/span><span><br \/><font size=\"3\">PS WSMan:\\&gt; Connect-WSMan weiwu-lh64<br \/>PS WSMan:\\&gt; get-item .\\weiwu-lh64\\Service\\Auth\\CredSSP<br \/><span>&nbsp;&nbsp; <\/span>WSManConfig: Microsoft.WSMan.Management\\WSMan::weiwu-lh64\\Service\\Auth<br \/>Name<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span>Value<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span>Type<br \/>&#8212;-<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>&#8212;&#8211;<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span>&#8212;-<br \/>CredSSP<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>false<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span><span>&nbsp;<\/span>System.String<br \/>PS WSMan:\\&gt; set-item .\\weiwu-lh64\\Service\\Auth\\CredSSP true<br \/>PS WSMan:\\&gt; New-PSSession weiwu-lh64.ntdev.corp.microsoft.com -cred $cred -Authentication credssp Id Name<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>ComputerName<span>&nbsp;&nbsp;&nbsp; <\/span>State<span>&nbsp;&nbsp;&nbsp; <\/span>Configuration<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>Availability<br \/><span>&nbsp;<\/span>&#8212; &#8212;-<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>&#8212;&#8212;&#8212;&#8212;<span>&nbsp;&nbsp;&nbsp; <\/span>&#8212;&#8211;<span>&nbsp;&nbsp;&nbsp; <\/span>&#8212;&#8212;&#8212;&#8212;-<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>&#8212;&#8212;&#8212;&#8212;<br \/><span>&nbsp; <\/span>1 Session1<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>weiwu-lh64.n&#8230; Opened<span>&nbsp;&nbsp; <\/span>Microsoft.PowerShell<span>&nbsp;&nbsp;&nbsp;&nbsp; <\/span>Available<br \/>PS WSMan:\\&gt; Disconnect-WSMan weiwu-lh64<br \/>PS WSMan:\\&gt; Disable-WSManCredSSP<\/font><\/span><\/p>\n<p class=\"MsoNormal\">Enjoy!<\/p>\n<p>Wei Wu[MSFT] <br \/>Visit the Windows PowerShell Team blog at:&nbsp;&nbsp;&nbsp; <a href=\"http:\/\/blogs.msdn.com\/PowerShell\"><strong><font color=\"#006bad\">http:\/\/blogs.msdn.com\/PowerShell<\/font><\/strong><\/a> <br \/>Visit the Windows PowerShell ScriptCenter at:&nbsp; <a href=\"http:\/\/www.microsoft.com\/technet\/scriptcenter\/hubs\/msh.mspx\"><strong><font color=\"#006bad\">http:\/\/www.microsoft.com\/technet\/scriptcenter\/hubs\/msh.mspx<\/font><\/strong><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>PowerShell remoting is built on top of Windows Remote Management (WinRM), which is Microsoft\u2019s implementation of WS-Management protocol. You can use winrm.cmd command line tool to query and manage winrm settings. PowerShell V2 CTP3 contains a wsman provider for you to manage winrm settings with the standard *-Item cmdlets . Let\u2019s try it out: PS [&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":[8],"class_list":["post-4801","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-powershell","tag-remoting"],"acf":[],"blog_post_summary":"<p>PowerShell remoting is built on top of Windows Remote Management (WinRM), which is Microsoft\u2019s implementation of WS-Management protocol. You can use winrm.cmd command line tool to query and manage winrm settings. PowerShell V2 CTP3 contains a wsman provider for you to manage winrm settings with the standard *-Item cmdlets . Let\u2019s try it out: PS [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/posts\/4801","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=4801"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/posts\/4801\/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=4801"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/categories?post=4801"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/tags?post=4801"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}