wordpress   发布时间:2022-04-02  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了windows-server-2008-r2 – localhost上的Enter-PSSession失败大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

概述

我试图执行以下Power sHell命令: Enter-PSSession -ComputerName localhost 正在使用的服务器正在运行Windows Server 2008 R2 SP1 64位.服务器位于域中.我在我的域管理员帐户下登录. powersHell会话以管理员身份启动. 我从PowerSHell本身收到以下错误消息: PS C:\Users\Daniel> Enter-
我试图执行以下Power shell命令: @H_616_15@Enter-PSSession -ComputerName localhost

正在使用的服务器正在运行Windows Server 2008 R2 SP1 64位.服务器位于域中.我在我的域管理员帐户下登录. powersHell会话以管理员身份启动.

我从PowerSHell本身收到以下错误消息:

@H_616_15@PS C:\Users\Daniel> Enter-PSSession -Computername localhost Enter-PSSession : ConnecTing to Remote Server localhost @L_450_6@ with the following error message : The client cAnnot connect to the desTination specified in the request. Verify that the service on the desTination is running and is accepTing requests. Consult the logs and documentation for the WS-Management service running on the desTination,most commonly IIS or WinRm. If the desTination is the WinRM service,run the following command on the desTination to analyze and configure the WinRM service: "winrm quickconfig". For more information,see the about_Remote_TroubleshooTing Help topic. At line:1 char:1 + Enter-PSSession -Computername localhost + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidArgument: (localhost:string) [Enter-PSSession],PSRemoTingTransportException + FullyQualifiedErrorId : CreateRemoteRunspace@L_450_6@ PS C:\Users\Daniel>

使用事件查看器,我能够在应用程序和服务日志>下搜索以下两个错误. Microsoft> Windows> Windows远程管理>操作

@H_616_15@General: The client cAnnot connect to the desTination specified in the request. Verify that the service on the desTination is running and is accepTing requests. Consult the logs and documentation for the WS-Management service running on the desTination,most commonly IIS or WinRm. If the desTination is the WinRM service,run the following command on the desTination to analyze and configure the WinRM service: "winrm quickconfig". Detail: <Event xmlns="http://scheR_70_11845@as.microsoft.com/win/2004/08/events/event"> <System> <Provider Name="Microsoft-Windows-WinRM" Guid="{A7975C8F-AC13-49F1-87DA-5A984A4AB417}" /> <EventID>161</EventID> <Version>0</Version> <Level>2</Level> <Task>7</Task> <Opcode>0</Opcode> <Keywords>0x400000000000000a</Keywords> <TimeCreated SystemTime="2016-08-17T23:10:40.766446000Z" /> <EventRecordID>56814</EventRecordID> <Correlation ActivityID="{0190DC40-F800-0000-3291-5DB0DAF8D101}" /> <Execution ProcessID="7888" ThreadID="7912" /> <ChAnnel>Microsoft-Windows-WinRM/Operational</ChAnnel> <Computer>FNZAS2.flow.net.nz</Computer> <Security UserID="S-1-5-21-2875926586-1071052228-4104636349-1151" /> </System> <EventData> <Data Name="authFailuremessage">The client cAnnot connect to the desTination specified in the request. Verify that the service on the desTination is running and is accepTing requests. Consult the logs and documentation for the WS-Management service running on the desTination,run the following command on the desTination to analyze and configure the WinRM service: "winrm quickconfig".</Data> </EventData> </Event> General: Wsman operation CreateSHell @L_450_6@,error code 2150858770 Detail: <Event xmlns="http://scheR_70_11845@as.microsoft.com/win/2004/08/events/event"> <System> <Provider Name="Microsoft-Windows-WinRM" Guid="{A7975C8F-AC13-49F1-87DA-5A984A4AB417}" /> <EventID>142</EventID> <Version>0</Version> <Level>2</Level> <Task>10</Task> <Opcode>2</Opcode> <Keywords>0x4000000000000002</Keywords> <TimeCreated SystemTime="2016-08-17T23:10:40.766446000Z" /> <EventRecordID>56816</EventRecordID> <Correlation ActivityID="{0190DC40-F800-0000-2F91-5DB0DAF8D101}" /> <Execution ProcessID="7888" ThreadID="7912" /> <ChAnnel>Microsoft-Windows-WinRM/Operational</ChAnnel> <Computer>FNZAS2.flow.net.nz</Computer> <Security UserID="S-1-5-21-2875926586-1071052228-4104636349-1151" /> </System> <EventData> <Data Name="operationName">CreateSHell</Data> <Data Name="errorCode">2150858770</Data> </EventData> </Event>

我一直在尝试很多东西来验证一切.这是一些更长的PowerSHell输出,以显示我迄今为止的一些工作.

@H_616_15@PS C:\Users\Daniel> $PSVersionTable.PSVersion Major Minor Build Revision ----- ----- ----- -------- 4 0 -1 -1 PS C:\Users\Daniel> winrm quickconfig WinRM service is already running on this machine. WinRM is already set up for remote management on this computer. PS C:\Users\Daniel> Enable-PSRemoTing WinRM Quick Configuration Running command "Set-WsmanQuickConfig" to enable remote management of this computer by using the Windows Remote Management (WinRM) service. This includes: 1. StarTing or restarTing (if already started) the WinRM service 2. SetTing the WinRM service startup type to Automatic 3. CreaTing a listener to accept requests on any IP address 4. Enabling Windows Firewall inbound rule exceptions for WS-Management traffic (for http only). Do you want to conTinue? [Y] Yes [A] Yes to All [n] No [L] No to All [S] Suspend [?] Help (default is "Y"): A WinRM is already set up to receive requests on this computer. WinRM is already set up for remote management on this computer. Confirm Are you sure you want to perform this action? Performing the operation "Set-PSSessionConfiguration" on target "Name: microsoft.powersHell SDDL: O:NSG:BAD:P(A;;GA;;;BA)S:P(AU;FA;GA;;;WD)(AU;SA;GXGW;;;WD). This lets SELEcted users remotely run Windows PowerSHell commands on this computer.". [Y] Yes [A] Yes to All [n] No [L] No to All [S] Suspend [?] Help (default is "Y"): A PS C:\Users\Daniel> Enable-PSRemoTing -force WinRM is already set up to receive requests on this computer. WinRM is already set up for remote management on this computer. PS C:\Users\Daniel> winrm get winrm/config Config MaxEnvelopeSizekb = 500 MaxTimeoutms = 60000 MaxBatchItems = 32000 MaxProviderrequests = 4294967295 Client NetworkDelayms = 5000 URLPrefix = wsman AllowUnencrypted = true [source="GPO"] Auth Basic = true [source="GPO"] Digest = true Kerberos = true Negotiate = true Certificate = true CredSSP = true [source="GPO"] DefaultPorts http = 5985 httpS = 5986 TrustedHosts = * service RootSDDL = O:NSG:BAD:P(A;;GA;;;BA)(A;;GR;;;IU)S:P(AU;FA;GA;;;WD)(AU;SA;GXGW;;;WD) MaxConcurrentOperations = 4294967295 MaxConcurrentOperationsPerUser = 1500 EnumerationTimeoutms = 240000 MaxConnections = 300 MaxPacketRetrievalTimeSeconds = 120 AllowUnencrypted = false Auth Basic = true [source="GPO"] Kerberos = true Negotiate = true Certificate = false CredSSP = true [source="GPO"] CbtHardeningLevel = Relaxed DefaultPorts http = 5985 httpS = 5986 IPv4Filter [source="GPO"] IPv6Filter [source="GPO"] EnableCompatibilityhttpListener = false EnableCompatibilityhttpsListener = false CertificateThumbprint AllowRemoteAccess = true [source="GPO"] Winrs AllowRemoteSHellAccess = true [source="GPO"] IdleTimeout = 7200000 MaxConcurrentUsers = 10 MaxSHellRunTime = 2147483647 MaxProcessesPerSHell = 25 MaxMemoryPerSHellMB = 1000 MaxSHellsPerUser = 30 PS C:\Users\Daniel> winrm e winrm/config/listener Listener [source="GPO"] Address = * Transport = http Port = 5985 Hostname Enabled = true URLPrefix = wsman CertificateThumbprint ListeningOn = null PS C:\Users\Daniel> get-service WinRM Status Name DisplayName ------ ---- ----------- Running WinRM Windows Remote Management (WS-Manag... PS C:\Users\Daniel> winrm get wmicimv2/Win32_service?Name=WinRM Win32_service AcceptPause = false AcceptStop = true Caption = Windows Remote Management (WS-Management) checkPoint = 0 CreationClassName = Win32_service Description = Windows Remote Management (WinRM) service implements the WS-Management protocol for remote management. WS-Management is a standard web services protocol used for remote software and hardware management. The WinRM service l istens on the network for WS-Management requests and processes them. The WinRM service needs to be configured with a lis tener using winrm.cmd command line tool or through Group Policy in order for it to listen over the network. The WinRM se rvice provides access to WMI data and enables event collection. Event collection and subscription to events require that the service is running. WinRM messages use http and httpS as transports. The WinRM service does not depend on IIS but i s preconfigured to share a port with IIS on the same machine. The WinRM service reserves the /wsman URL prefix. To prev ent conflicts with IIS,administrators should ensure that any websites hosted on IIS do not use the /wsman URL prefix. DesktopInteract = false DisplayName = Windows Remote Management (WS-Management) ErrorControl = Normal ExitCode = 0 InstallDate = null Name = WinRM PathName = C:\Windows\System32\svchost.exe -k Networkservice ProcessId = 936 serviceSpecificExitCode = 0 serviCEType = Share Process Started = true StartMode = Auto StartName = NT AUTHORITY\Networkservice State = Running Status = OK SystemCreationClassName = Win32_ComputerSystem SystemName = FNZAS2 TagId = 0 WaitHint = 0 PS C:\Users\Daniel> winrm id IdentifyResponse ProtocolVersion = http://scheR_70_11845@as.dmtf.org/wbem/wsman/1/wsman.xsd ProductVendor = Microsoft Corporation ProductVersion = OS: 6.1.7601 SP: 1.0 Stack: 3.0 SecurityProfiles SecurityProfilename = http://scheR_70_11845@as.dmtf.org/wbem/wsman/1/wsman/secprofile/http/basic,http://scheR_70_11845@as.dmtf.org/ wbem/wsman/1/wsman/secprofile/http/spnego-kerberos PS C:\Users\Daniel> Enter-PSSession -ComputerName localhost Enter-PSSession : ConnecTing to Remote Server localhost @L_450_6@ with the following error message : The client cAnnot connect to the desTination specified in the request. Verify that the service on the desTination is running and is accepTing requests. Consult the logs and documentation for the WS-Management service running on the desTination,see the about_Remote_TroubleshooTing Help topic. At line:1 char:1 + Enter-PSSession -ComputerName localhost + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidArgument: (localhost:string) [Enter-PSSession],PSRemoTingTransportException + FullyQualifiedErrorId : CreateRemoteRunspace@L_450_6@ PS C:\Users\Daniel>

我也尝试重新启动WinRM服务,以及重新启动整个服务器.仍然得到相同的错误.

这很容易错过.对于我的(不熟练的)眼睛,事件查看器中的第二条错误消息似乎有意义:

Wsman操作CreateSHell失败,错误代码2150858770

我在服务器故障上的another question发现了这个错误代码,但是没有答案.

我设法找到类似的问题here.我已经尝试了Arthur_Li建议的MaxFieldLength和MaxrequestBytes,但这并没有解决我的问题.

错误代码看起来可能是十进制的,所以我尝试将其转换为十六进制并搜索十六进制代码,并没有找到任何基本错误代码尚未出现的内容.

我完全被这一点困扰了.我之前在其他服务器上设置了PowerSHell RemoTing,没有这样的问题.

我收到的一条建议是:“停止使用2008 R2.升级到更新的东西.”我们计划在未来六个月的某个时间做这件事.但是,直到最早可能在9月底,我们才能采取行动.

我可以通过登录机器,上传部署脚本和自行打包以及手动运行来解决这个问题.但这种方式首先打破了自动部署流程的重点.

任何帮助将不胜感激.

更新#1

尝试删除然后还原WinRM的认侦听器.

@H_616_15@PS C:\Users\Daniel> winrm delete winrm/config/listener?address=*+transport=http WsmanFault message ProviderFault WsmanFault message = WS-Management does not allow changes to a listener created automatically by the group policy. The policy "Allow Auto Configuration of listeners on WinRm service" would need to be set to "Not Configured" in order to create a new listener for same Address and Transport or to modify an already exisTing listener. Error number: -2144108406 0x8033808A CAnnot change GPO controlled setTing.

我去了gpedit.msc.事实证明,“允许在WinRm服务上自动配置侦听器”无益地重命名为“允许通过WinRM进行远程服务器管理”.我将其设置为“未配置”并再次尝试.

@H_616_15@PS C:\Users\Daniel> winrm delete winrm/config/listener?address=*+transport=http PS C:\Users\Daniel> winrm create winrm/config/Listener?Address=*+Transport=http resourceCreated Address = http://scheR_70_11845@as.xmlsoap.org/ws/2004/08/addressing/role/anonymous ReferenceParameters resourceURI = http://scheR_70_11845@as.microsoft.com/wbem/wsman/1/config/listener SELEctorSet SELEctor: Address = *,Transport = http PS C:\Users\Daniel> winrm e winrm/config/listener Listener Address = * Transport = http Port = 5985 Hostname Enabled = true URLPrefix = wsman CertificateThumbprint ListeningOn = 10.10.90.6,127.0.0.1,::1,fe80::100:7f:fffe%11,fe80::5efe:10.10.90.6%13 PS C:\Users\Daniel> Enter-PSSession -ComputerName localhost Enter-PSSession : ConnecTing to Remote Server localhost @L_450_6@ with the following error message : WinRM cAnnot process the request. The following error with error@R_542_6756@x80090322 occurred while using Negotiate authentication: An unkNown security error occurred. Possible causes are: -The user name or password specified are invalid. -Kerberos is used when no authentication method and no user name are specified. -Kerberos accepts domain user names,but not local user names. -The service Principal Name (SPN) for the remote computer name and port does not exist. -The client and remote computers are in different domains and there is no trust between the two domains. After checking for the above issues,try the following: -check the Event Viewer for events related to authentication. -Change the authentication method; add the desTination computer to the WinRM TrustedHosts configuration setTing or use httpS transport. Note that computers in the TrustedHosts list might not be authenticated. -For more information about WinRM configuration,run the following command: winrm Help config. For more information,see the about_Remote_TroubleshooTing Help topic. At line:1 char:1 + Enter-PSSession -ComputerName localhost + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidArgument: (localhost:string) [Enter-PSSession],PSRemoTingTransportException + FullyQualifiedErrorId : CreateRemoteRunspace@L_450_6@ PS C:\Users\Daniel>

关于该主题,这是我的WinRM GPO的当前配置

本地计算机政策> <计算机配置>管理模板> Windows组件> Windows远程管理(WinRM)> WinRM客户端

>允许基本身份验证:已启用
>允许CredSSP身份验证:已启用
>允许未加密的流量:已启用
>禁止摘要式身份验证:未配置
>禁止Kerberos身份验证:未配置
>禁止协商身份验证:未配置
>可信主机:未配置

本地计算机政策> <计算机配置>管理模板> Windows组件> Windows远程管理(WinRM)> WinRM服务器

>允许通过WinRM进行远程服务器管理:未配置(注意:在此更新之前的示例中,此设置为“已启用”)
>允许基本身份验证:已启用
>允许CredSSP身份验证:已启用
>允许未加密的流量:已启用
>指定通道绑定令牌加固级别:未配置
>禁止WinRM存储RunAs凭据:未配置
>禁止Kerberos身份验证:未配置
>禁止协商身份验证:未配置
>打开兼容性http侦听器:未配置
>打开兼容性httpS侦听器:未配置

错误消息已更改.当我跳转到事件查看器时,我现在得到以下两个错误.请注意,他们都改变了.第一个发生了巨大变化,第二个变化不大.

@H_616_15@General: Omitted for brevity. Same as per the "authFailuremessage" in the details below. Detail: <Event xmlns="http://scheR_70_11845@as.microsoft.com/win/2004/08/events/event"> <System> <Provider Name="Microsoft-Windows-WinRM" Guid="{A7975C8F-AC13-49F1-87DA-5A984A4AB417}" /> <EventID>161</EventID> <Version>0</Version> <Level>2</Level> <Task>7</Task> <Opcode>0</Opcode> <Keywords>0x400000000000000a</Keywords> <TimeCreated SystemTime="2016-08-18T00:37:41.784323600Z" /> <EventRecordID>61452</EventRecordID> <Correlation ActivityID="{0190DC40-F800-0000-79D1-5DB0DAF8D101}" /> <Execution ProcessID="7888" ThreadID="8116" /> <ChAnnel>Microsoft-Windows-WinRM/Operational</ChAnnel> <Computer>FNZAS2.flow.net.nz</Computer> <Security UserID="S-1-5-21-2875926586-1071052228-4104636349-1151" /> </System> <EventData> <Data Name="authFailuremessage">WinRM cAnnot process the request. The following error with error@R_542_6756@x80090322 occurred while using Negotiate authentication: An unkNown security error occurred. Possible causes are: -The user name or password specified are invalid. -Kerberos is used when no authentication method and no user name are specified. -Kerberos accepts domain user names,but not local user names. -The service Principal Name (SPN) for the remote computer name and port does not exist. -The client and remote computers are in different domains and there is no trust between the two domains. After checking for the above issues,try the following: -check the Event Viewer for events related to authentication. -Change the authentication method; add the desTination computer to the WinRM TrustedHosts configuration setTing or use httpS transport. Note that computers in the TrustedHosts list might not be authenticated. -For more information about WinRM configuration,run the following command: winrm Help config.</Data> </EventData> </Event> General: Wsman operation CreateSHell @L_450_6@,error code 2150858909 Details: <Event xmlns="http://scheR_70_11845@as.microsoft.com/win/2004/08/events/event"> <System> <Provider Name="Microsoft-Windows-WinRM" Guid="{A7975C8F-AC13-49F1-87DA-5A984A4AB417}" /> <EventID>142</EventID> <Version>0</Version> <Level>2</Level> <Task>10</Task> <Opcode>2</Opcode> <Keywords>0x4000000000000002</Keywords> <TimeCreated SystemTime="2016-08-18T00:37:41.784323600Z" /> <EventRecordID>61454</EventRecordID> <Correlation ActivityID="{0190DC40-F800-0000-7CD1-5DB0DAF8D101}" /> <Execution ProcessID="7888" ThreadID="8116" /> <ChAnnel>Microsoft-Windows-WinRM/Operational</ChAnnel> <Computer>FNZAS2.flow.net.nz</Computer> <Security UserID="S-1-5-21-2875926586-1071052228-4104636349-1151" /> </System> <EventData> <Data Name="operationName">CreateSHell</Data> <Data Name="errorCode">2150858909</Data> </EventData> </Event>

更新#2

尝试清除WinRM设置,然后恢复认值.

PowersHell输出:pastebin.com/E5wgXE1q

底层Windows事件日志与update#1中生成的日志相同.

更新#3

使用Mer的winrm / config输出作为指南,我已经浏览了我的本地计算机组策略对象并将所有内容重置为“未配置”这给了我一个与Mer的匹配的winrm / config输出.

然而,我仍然无法通过.为了安全起见,在update#2中尝试了相同的清除/重置步骤,但这也没有用.

pastebin.com/EuzyDR6d上的PowersHell输出

事件日志中的输出与更新2中的输出相同.

将尝试重新启动服务器,看看是否有所作为.

更新#4

服务器重启没有修复.仍然获得与update#2相同的错误消息.

更新#5

好的.这很坚果.

上面的所有问题都是在我们称之为AS2的服务器上.

我刚刚跳到AS1服务器,并设置了远程PowerSHell.只是为了确保我不会疯狂.

> AS1:Enter-PSSession localhost>成功
> AS1:输入-PSSession AS2>成功
> AS2:输入-PSSession localhost>失败
> AS2:输入-PSSession AS1>成功

早些时候,我遇到了从AS2进入任何服务器的问题.但在某条线上,我修复了这个问题.现在只是AS2上的本地主机就是问题所在.

这感觉完全疯了.为什么AS2无法远程接入自己,当它显然很乐意接受传入连接时,它可以使传出连接变好吗?

更新#6

好的,新信息:CredSSP身份验证确实有效.它似乎特别与此服务器上的协商身份验证有关.

我或许能够将此作为我正在尝试的解决方法的基础.这仍然无法解释为什么Negotiate似乎在这台服务器上被破坏了.

你可以删除现有的监听器: @H_616_15@winrm delete winrm/config/listener?address=*+transport=http

添加一个新的:

@H_616_15@winrm create winrm/config/Listener?Address=*+Transport=http

并再次检查:

@H_616_15@winrm e winrm/config/listener

ListeningOn应列出您的IP地址,而不是null.

大佬总结

以上是大佬教程为你收集整理的windows-server-2008-r2 – localhost上的Enter-PSSession失败全部内容,希望文章能够帮你解决windows-server-2008-r2 – localhost上的Enter-PSSession失败所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。