Ana*_*ukh 5 powershell remote-access winrm azure-devops azure-devops-extensions
我已经配置了Winrm。
winrm quickconfig由于winrm服务已在运行,因此我在响应以下。
WinRM service is already running on this machine.
WinRM is already set up for remote management on this computer.
Run Code Online (Sandbox Code Playgroud)
另外,如果我愿意 New-PSSession -ComputerName DESKTOP-0DNHIDE
我的输出低于
Id Name ComputerName ComputerType State ConfigurationName Availability
-- ---- ------------ ------------ ----- ----------------- ------------
5 WinRM5 DESKTOP-0DNHIDE RemoteMachine Opened Microsoft.PowerShell Available
Run Code Online (Sandbox Code Playgroud)
我也可以使用以下方法建立PSConnection
`Enter-PSSession -Computername DESKTOP-0DNHIDE`
Run Code Online (Sandbox Code Playgroud)
但是仍然当我尝试使用Azure Devops Pipeline部署CSharp应用程序时出现以下错误
[error]Microsoft.PowerShell.Commands.WriteErrorException: Deployment on one or more machines failed. System.Management.Automation.Remoting.PSRemotingTransportException: Connecting to remote server xx.xx.xx.xx failed 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.
Run Code Online (Sandbox Code Playgroud)
我在azure devops管道中使用WinRM-IIS Web App部署任务在本地IIS服务器上部署CSharp应用程序。
为我的本地计算机配置了AzureDevops代理。
来自发布管道的完整日志如下:
2019-07-19T02:58:20.7948043Z ##[debug]Evaluating condition for step: 'Manage IISWebsite'
2019-07-19T02:58:20.7950382Z ##[debug]Evaluating: succeeded()
2019-07-19T02:58:20.7950615Z ##[debug]Evaluating succeeded:
2019-07-19T02:58:20.7951602Z ##[debug]=> True
2019-07-19T02:58:20.7952146Z ##[debug]Result: True
2019-07-19T02:58:20.7952671Z ##[section]Starting: Manage IISWebsite
2019-07-19T02:58:20.8496506Z ==============================================================================
2019-07-19T02:58:20.8496698Z Task : WinRM - IIS Web App Management
2019-07-19T02:58:20.8496768Z Description : Connect via WinRM, to create or update a Website, Web App, Virtual Directories, and Application Pool locally on IIS
2019-07-19T02:58:20.8496827Z Version : 2.1.0
2019-07-19T02:58:20.8496861Z Author : Microsoft Corporation
2019-07-19T02:58:20.8496895Z Help : [More Information](http://aka.ms/IISMgmt)
2019-07-19T02:58:20.8496934Z ==============================================================================
2019-07-19T02:58:20.8798461Z Preparing task execution handler.
2019-07-19T02:58:21.7605314Z Executing the powershell script: E:\NewAgent\_work\_tasks\IISWebAppMgmt_0f5cd14f-3c01-4d5c-8f7a-eb96c5738dcc\2.1.0\Main.ps1
2019-07-19T02:58:21.7606356Z ##[debug]PowerShellHandler.Execute - AddCommand(E:\NewAgent\_work\_tasks\IISWebAppMgmt_0f5cd14f-3c01-4d5c-8f7a-eb96c5738dcc\2.1.0\Main.ps1)
2019-07-19T02:58:21.7606607Z ##[debug]PowerShellHandler.Execute - Add inputParameters
2019-07-19T02:58:21.7606785Z ##[debug]PowerShellHandler.Execute - AddParameter(machinesList=localhost)
2019-07-19T02:58:21.7606939Z ##[debug]PowerShellHandler.Execute - AddParameter(AdminUserName=desktop-0dnhide\hp)
2019-07-19T02:58:21.7607111Z ##[debug]PowerShellHandler.Execute - AddParameter(AdminPassword=*******)
2019-07-19T02:58:21.7607282Z ##[debug]PowerShellHandler.Execute - AddParameter(WinRMProtocol=Https)
2019-07-19T02:58:21.7607481Z ##[debug]PowerShellHandler.Execute - AddParameter(TestCertificate=true)
2019-07-19T02:58:21.7607679Z ##[debug]PowerShellHandler.Execute - AddParameter(IISDeploymentType=IISWebsite)
2019-07-19T02:58:21.7607883Z ##[debug]PowerShellHandler.Execute - AddParameter(ActionIISWebsite=CreateOrUpdateWebsite)
2019-07-19T02:58:21.7607995Z ##[debug]PowerShellHandler.Execute - AddParameter(ActionIISApplicationPool=CreateOrUpdateAppPool)
2019-07-19T02:58:21.7608086Z ##[debug]PowerShellHandler.Execute - AddParameter(StartStopWebsiteName=)
2019-07-19T02:58:21.7608180Z ##[debug]PowerShellHandler.Execute - AddParameter(WebsiteName=POC)
2019-07-19T02:58:21.7608260Z ##[debug]PowerShellHandler.Execute - AddParameter(WebsitePhysicalPath=D:\PublishApplication\POC\)
2019-07-19T02:58:21.7608349Z ##[debug]PowerShellHandler.Execute - AddParameter(WebsitePhysicalPathAuth=WebsiteUserPassThrough)
2019-07-19T02:58:21.7608429Z ##[debug]PowerShellHandler.Execute - AddParameter(WebsiteAuthUserName=)
2019-07-19T02:58:21.7608517Z ##[debug]PowerShellHandler.Execute - AddParameter(WebsiteAuthUserPassword=)
2019-07-19T02:58:21.7608597Z ##[debug]PowerShellHandler.Execute - AddParameter(AddBinding=true)
2019-07-19T02:58:21.7608699Z ##[debug]PowerShellHandler.Execute - AddParameter(CreateOrUpdateAppPoolForWebsite=true)
2019-07-19T02:58:21.7608783Z ##[debug]PowerShellHandler.Execute - AddParameter(ConfigureAuthenticationForWebsite=false)
2019-07-19T02:58:21.7608870Z ##[debug]PowerShellHandler.Execute - AddParameter(Protocol=http)
2019-07-19T02:58:21.7609293Z ##[debug]PowerShellHandler.Execute - AddParameter(IPAddress=All Unassigned)
2019-07-19T02:58:21.7609385Z ##[debug]PowerShellHandler.Execute - AddParameter(Port=8086)
2019-07-19T02:58:21.7609468Z ##[debug]PowerShellHandler.Execute - AddParameter(ServerNameIndication=false)
2019-07-19T02:58:21.7609548Z ##[debug]PowerShellHandler.Execute - AddParameter(HostNameWithOutSNI=)
2019-07-19T02:58:21.7609638Z ##[debug]PowerShellHandler.Execute - AddParameter(HostNameWithHttp=)
2019-07-19T02:58:21.7609718Z ##[debug]PowerShellHandler.Execute - AddParameter(HostNameWithSNI=)
2019-07-19T02:58:21.7611169Z ##[debug]PowerShellHandler.Execute - AddParameter(SSLCertThumbPrint=)
2019-07-19T02:58:21.7611253Z ##[debug]PowerShellHandler.Execute - AddParameter(AppPoolNameForWebsite=POC-Pool)
2019-07-19T02:58:21.7611341Z ##[debug]PowerShellHandler.Execute - AddParameter(DotNetVersionForWebsite=v4.0)
2019-07-19T02:58:21.7611423Z ##[debug]PowerShellHandler.Execute - AddParameter(PipeLineModeForWebsite=Integrated)
2019-07-19T02:58:21.7611526Z ##[debug]PowerShellHandler.Execute - AddParameter(AppPoolIdentityForWebsite=ApplicationPoolIdentity)
2019-07-19T02:58:21.7611607Z ##[debug]PowerShellHandler.Execute - AddParameter(AppPoolUsernameForWebsite=)
2019-07-19T02:58:21.7611686Z ##[debug]PowerShellHandler.Execute - AddParameter(AppPoolPasswordForWebsite=)
2019-07-19T02:58:21.7611774Z ##[debug]PowerShellHandler.Execute - AddParameter(AnonymousAuthenticationForWebsite=false)
2019-07-19T02:58:21.7611852Z ##[debug]PowerShellHandler.Execute - AddParameter(BasicAuthenticationForWebsite=false)
2019-07-19T02:58:21.7611951Z ##[debug]PowerShellHandler.Execute - AddParameter(WindowsAuthenticationForWebsite=true)
2019-07-19T02:58:21.7612029Z ##[debug]PowerShellHandler.Execute - AddParameter(ParentWebsiteNameForVD=)
2019-07-19T02:58:21.7612117Z ##[debug]PowerShellHandler.Execute - AddParameter(VirtualPathForVD=)
2019-07-19T02:58:21.7612198Z ##[debug]PowerShellHandler.Execute - AddParameter(PhysicalPathForVD=%SystemDrive%\inetpub\wwwroot)
2019-07-19T02:58:21.7612293Z ##[debug]PowerShellHandler.Execute - AddParameter(VDPhysicalPathAuth=VDUserPassThrough)
2019-07-19T02:58:21.7612372Z ##[debug]PowerShellHandler.Execute - AddParameter(VDAuthUserName=)
2019-07-19T02:58:21.7612456Z ##[debug]PowerShellHandler.Execute - AddParameter(VDAuthUserPassword=)
2019-07-19T02:58:21.7612535Z ##[debug]PowerShellHandler.Execute - AddParameter(ParentWebsiteNameForApplication=)
2019-07-19T02:58:21.7612618Z ##[debug]PowerShellHandler.Execute - AddParameter(VirtualPathForApplication=)
2019-07-19T02:58:21.7612700Z ##[debug]PowerShellHandler.Execute - AddParameter(PhysicalPathForApplication=%SystemDrive%\inetpub\wwwroot)
2019-07-19T02:58:21.7612789Z ##[debug]PowerShellHandler.Execute - AddParameter(ApplicationPhysicalPathAuth=ApplicationUserPassThrough)
2019-07-19T02:58:21.7612875Z ##[debug]PowerShellHandler.Execute - AddParameter(ApplicationAuthUserName=)
2019-07-19T02:58:21.7612953Z ##[debug]PowerShellHandler.Execute - AddParameter(ApplicationAuthUserPassword=)
2019-07-19T02:58:21.7613048Z ##[debug]PowerShellHandler.Execute - AddParameter(CreateOrUpdateAppPoolForApplication=false)
2019-07-19T02:58:21.7613128Z ##[debug]PowerShellHandler.Execute - AddParameter(AppPoolNameForApplication=)
2019-07-19T02:58:21.7613214Z ##[debug]PowerShellHandler.Execute - AddParameter(DotNetVersionForApplication=v4.0)
2019-07-19T02:58:21.7613292Z ##[debug]PowerShellHandler.Execute - AddParameter(PipeLineModeForApplication=Integrated)
2019-07-19T02:58:21.7613447Z ##[debug]PowerShellHandler.Execute - AddParameter(AppPoolIdentityForApplication=ApplicationPoolIdentity)
2019-07-19T02:58:21.7613540Z ##[debug]PowerShellHandler.Execute - AddParameter(AppPoolUsernameForApplication=)
2019-07-19T02:58:21.7613628Z ##[debug]PowerShellHandler.Execute - AddParameter(AppPoolPasswordForApplication=)
2019-07-19T02:58:21.7613707Z ##[debug]PowerShellHandler.Execute - AddParameter(AppPoolName=)
2019-07-19T02:58:21.7613795Z ##[debug]PowerShellHandler.Execute - AddParameter(DotNetVersion=v4.0)
2019-07-19T02:58:21.7614062Z ##[debug]PowerShellHandler.Execute - AddParameter(PipeLineMode=Integrated)
2019-07-19T02:58:21.7614152Z ##[debug]PowerShellHandler.Execute - AddParameter(AppPoolIdentity=ApplicationPoolIdentity)
2019-07-19T02:58:21.7614233Z ##[debug]PowerShellHandler.Execute - AddParameter(AppPoolUsername=)
2019-07-19T02:58:21.7614312Z ##[debug]PowerShellHandler.Execute - AddParameter(AppPoolPassword=)
2019-07-19T02:58:21.7614398Z ##[debug]PowerShellHandler.Execute - AddParameter(StartStopRecycleAppPoolName=)
2019-07-19T02:58:21.7614476Z ##[debug]PowerShellHandler.Execute - AddParameter(AppCmdCommands=)
2019-07-19T02:58:21.7615059Z ##[debug]PowerShellHandler.Execute - AddParameter(DeployInParallel=true)
2019-07-19T02:58:22.4170890Z ##[debug]PowerShellHandler.Execute - Invoke
2019-07-19T02:58:22.4171297Z ##[debug]Resetting input encoding.
2019-07-19T02:58:22.4172420Z ##[debug]Loading module from path 'E:\NewAgent\_work\_tasks\IISWebAppMgmt_0f5cd14f-3c01-4d5c-8f7a-eb96c5738dcc\2.1.0\VstsTaskSdk\VstsTaskSdk.psd1'.
2019-07-19T02:58:22.4172731Z ##[debug]Loading module from path 'E:\NewAgent\_work\_tasks\IISWebAppMgmt_0f5cd14f-3c01-4d5c-8f7a-eb96c5738dcc\2.1.0\VstsTaskSdk\VstsTaskSdk.psm1'.
2019-07-19T02:58:22.4280894Z ##[warning]VstsTaskSdk is designed for use with powershell.exe (ConsoleHost). Output may be different when used with other hosts.
2019-07-19T02:58:22.4293211Z ##[debug]Processed: ##vso[task.logissue type=warning]VstsTaskSdk is designed for use with powershell.exe (ConsoleHost). Output may be different when used with other hosts.
2019-07-19T02:58:22.4293844Z ##[debug]NonInteractive: False
2019-07-19T02:58:22.4294206Z ##[debug]Adding long path native methods.
2019-07-19T02:58:22.8215634Z ##[debug]Exporting function 'Find-Files'.
2019-07-19T02:58:22.8217695Z ##[debug]Exporting function 'Get-Endpoint'.
2019-07-19T02:58:22.8218463Z ##[debug]Exporting function 'Get-Input'.
2019-07-19T02:58:22.8218837Z ##[debug]Exporting function 'Get-TaskVariable'.
2019-07-19T02:58:22.8219129Z ##[debug]Exporting function 'Get-TaskVariableInfo'.
2019-07-19T02:58:22.8219320Z ##[debug]Exporting function 'Set-TaskVariable'.
2019-07-19T02:58:22.8219534Z ##[debug]Exporting function 'Get-LocString'.
2019-07-19T02:58:22.8219775Z ##[debug]Exporting function 'Import-LocStrings'.
2019-07-19T02:58:22.8219971Z ##[debug]Exporting function 'Write-AddAttachment'.
2019-07-19T02:58:22.8220186Z ##[debug]Exporting function 'Write-AddBuildTag'.
2019-07-19T02:58:22.8220384Z ##[debug]Exporting function 'Write-AssociateArtifact'.
2019-07-19T02:58:22.8240821Z ##[debug]Adding exceptions types.
2019-07-19T02:58:23.4242116Z ##[debug]Loading resource strings from: E:\NewAgent\_work\_tasks\IISWebAppMgmt_0f5cd14f-3c01-4d5c-8f7a-eb96c5738dcc\2.1.0\VstsTaskSdk\lib.json
2019-07-19T02:58:23.4258236Z
2019-07-19T02:58:23.4259926Z
2019-07-19T02:58:23.5622842Z ##[debug]Loaded 15 strings.
2019-07-19T02:58:23.5623707Z
2019-07-19T02:58:23.5624183Z
2019-07-19T02:58:23.6790360Z ##[debug]SYSTEM_CULTURE: 'en-US'
2019-07-19T02:58:23.6790598Z
2019-07-19T02:58:23.6790668Z
2019-07-19T02:58:23.6911976Z ##[debug]Importing the module 'Microsoft.PowerShell.Security'.
2019-07-19T02:58:23.6912832Z
2019-07-19T02:58:23.6913316Z
2019-07-19T02:58:23.7350193Z ##[warning]The 'Microsoft.PowerShell.Security' module was not imported because the 'Microsoft.PowerShell.Security' snap-in was already imported.
2019-07-19T02:58:23.7350721Z ##[debug]Processed: ##vso[task.logissue type=warning]The 'Microsoft.PowerShell.Security' module was not imported because the 'Microsoft.PowerShell.Security' snap-in was already imported.
2019-07-19T02:58:23.7351597Z
2019-07-19T02:58:23.7467957Z ##[debug]Loading module from path 'E:\NewAgent\_work\_tasks\IISWebAppMgmt_0f5cd14f-3c01-4d5c-8f7a-eb96c5738dcc\2.1.0\RemoteDeployer\RemoteDeployer.psd1'.
2019-07-19T02:58:23.7524741Z ##[debug]Loading module from path 'E:\NewAgent\_work\_tasks\IISWebAppMgmt_0f5cd14f-3c01-4d5c-8f7a-eb96c5738dcc\2.1.0\RemoteDeployer\RemoteDeployer.psm1'.
2019-07-19T02:58:23.8882064Z ##[debug]Loading resource strings from: E:\NewAgent\_work\_tasks\IISWebAppMgmt_0f5cd14f-3c01-4d5c-8f7a-eb96c5738dcc\2.1.0\RemoteDeployer\module.json
2019-07-19T02:58:23.9162207Z ##[debug]Loaded 10 strings.
2019-07-19T02:58:23.9176743Z ##[debug]SYSTEM_CULTURE: 'en-US'
2019-07-19T02:58:23.9182612Z ##[debug]Loading resource strings from: E:\NewAgent\_work\_tasks\IISWebAppMgmt_0f5cd14f-3c01-4d5c-8f7a-eb96c5738dcc\2.1.0\RemoteDeployer\Strings\resources.resjson\en-US\resources.resjson
2019-07-19T02:58:23.9487322Z ##[debug]Loaded 10 strings.
2019-07-19T02:58:23.9488965Z ##[debug]Exporting function 'Invoke-RemoteScript'.
2019-07-19T02:58:23.9493029Z ##[debug]Importing function 'Invoke-RemoteScript'.
2019-07-19T02:58:23.9494414Z ##[debug]Entering script Utility.ps1
2019-07-19T02:58:23.9722712Z ##[debug]Triming inputs for excess spaces, double quotes
2019-07-19T02:58:24.0255308Z ##[debug]Initiating action 'create or update' website with user specified application pool.
2019-07-19T02:58:24.0261470Z ##[debug]Triming inputs for excess spaces, double quotes
2019-07-19T02:58:24.0282354Z ##[debug]Initiating action 'create or update' website with user specified application pool.
2019-07-19T02:58:24.0873059Z ##[debug]Executing main funnction in AppCmdOnTargetMachines : Invoke-Main -ActionIISWebsite CreateOrUpdateWebsite -WebsiteName "POC" -PhysicalPath "D:\PublishApplication\POC" -PhysicalPathAuth "WebsiteUserPassThrough" -PhysicalPathAuthUsername "" -PhysicalPathAuthUserPassword "****" -AddBinding true -Bindings "{
2019-07-19T02:58:24.0873377Z `"port`": `"8086`",
2019-07-19T02:58:24.0873458Z `"sniFlag`": `"false`",
2019-07-19T02:58:24.0873504Z `"ipAddress`": `"All Unassigned`",
2019-07-19T02:58:24.0873546Z `"hostname`": `"`",
2019-07-19T02:58:24.0873599Z `"sslThumbprint`": {
2019-07-19T02:58:24.0873626Z
2019-07-19T02:58:24.0873665Z },
2019-07-19T02:58:24.0873704Z `"protocol`": `"http`"
2019-07-19T02:58:24.0873767Z }" -ActionIISApplicationPool "CreateOrUpdateAppPool" -AppPoolName "POC-Pool" -DotNetVersion "v4.0" -PipeLineMode "Integrated" -AppPoolIdentity ApplicationPoolIdentity -AppPoolUsername "" -AppPoolPassword "****" -configureAuthentication false -anonymousAuthentication false -basicAuthentication false -windowsAuthentication true -AppCmdCommands ""
2019-07-19T02:58:24.0992859Z ##[debug]Executing Run-RemoteDeployment
2019-07-19T02:58:24.1034386Z ##[debug]Executing Parse-TargetMachineNames
2019-07-19T02:58:24.1207070Z ##[debug]TargetMachineName: 'localhost'
2019-07-19T02:58:24.1254366Z ##[debug]Finished executing Parse-TargetMachineNames
2019-07-19T02:58:24.1353961Z ##[debug]Executing Get-NewPSSessionOption
2019-07-19T02:58:24.1356759Z ##[debug]New-PSSessionOption command: New-PSSessionOption -SkipCACheck
2019-07-19T02:58:24.1516828Z ##[debug]Finished executing Get-NewPSSessionOption
2019-07-19T02:58:24.1541020Z ##[debug]Executing Get-TargetMachineCredential: desktop-0dnhide\hp
2019-07-19T02:58:24.1624955Z ##[debug]Finished executing Get-TargetMachineCredential
2019-07-19T02:58:24.1641826Z Starting remote execution of Invoke-Main script for "IISWebsite" with action "CreateOrUpdateWebsite"
2019-07-19T02:58:24.1642167Z
2019-07-19T02:58:24.1642368Z
2019-07-19T02:58:24.2356493Z ##[debug]Entering Invoke-RemoteScript.
2019-07-19T02:58:24.2664601Z ##[debug] targetMachineNames: 'localhost'
2019-07-19T02:58:24.3174718Z ##[debug]Entering Get-TargetMachines.
2019-07-19T02:58:24.3250448Z ##[debug]Target Machines: localhost
2019-07-19T02:58:24.3470370Z ##[debug]ComputerName = localhost
2019-07-19T02:58:24.3502024Z ##[debug]WSManPort = 5986
2019-07-19T02:58:24.3508885Z ##[debug]Authentication = Default
2019-07-19T02:58:24.3509997Z ##[debug]SessionConfigurationName = microsoft.powershell
2019-07-19T02:58:24.3511134Z ##[debug]UseSSL = True
2019-07-19T02:58:24.3511754Z ##[debug]Total target machines are: 1
2019-07-19T02:58:24.3512392Z ##[debug]Leaving Get-TargetMachines.
2019-07-19T02:58:24.3955409Z ##[debug]Entering Get-WinRmConnectionToTargetMachine.
2019-07-19T02:58:24.3956756Z ##[debug] computerName: 'localhost'
2019-07-19T02:58:24.3958325Z ##[debug] port: '5986'
2019-07-19T02:58:24.3988051Z ##[debug] credential: 'System.Management.Automation.PSCredential'
2019-07-19T02:58:24.3989226Z ##[debug] authentication: 'Default'
2019-07-19T02:58:24.3991028Z ##[debug] sessionName: '25e787f9-5c81-4a00-97a0-778e363c1613'
2019-07-19T02:58:24.3992761Z ##[debug] sessionConfigurationName: 'microsoft.powershell'
2019-07-19T02:58:24.3994375Z ##[debug] useSsl: 'True'
2019-07-19T02:58:24.4127334Z ##[debug]Entering Get-NewPSSessionCommand.
2019-07-19T02:58:24.4128264Z ##[debug] computerName: 'localhost'
2019-07-19T02:58:24.4129785Z ##[debug] port: '5986'
2019-07-19T02:58:24.4131184Z ##[debug] authentication: 'Default'
2019-07-19T02:58:24.4132614Z ##[debug] sessionName: '25e787f9-5c81-4a00-97a0-778e363c1613'
2019-07-19T02:58:24.4133968Z ##[debug] useSsl: 'True'
2019-07-19T02:58:24.4135349Z ##[debug] sessionConfigurationName: 'microsoft.powershell'
2019-07-19T02:58:24.4136696Z ##[debug] NoCredential: 'False'
2019-07-19T02:58:24.4156316Z ##[debug]New-PSSessionCommand: New-PSSession -ComputerName 'localhost' -Port 5986 -Authentication Default -Name '25e787f9-5c81-4a00-97a0-778e363c1613' -Credential $credential -UseSSL -ErrorAction 'SilentlyContinue' -ErrorVariable sessionErrors -ConfigurationName 'microsoft.powershell'
2019-07-19T02:58:24.4159939Z ##[debug]Leaving Get-NewPSSessionCommand.
2019-07-19T02:58:24.4184417Z ##[debug]Trying to establish connection: Attempt #1
2019-07-19T02:58:26.5271873Z ##[debug]New-PSSession Error: Connecting to remote server localhost failed 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.
2019-07-19T02:58:56.5343753Z ##[debug]Trying to establish connection: Attempt #2
2019-07-19T02:58:58.5581592Z ##[debug]New-PSSession Error: Connecting to remote server localhost failed 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
小智 0
WMI 损坏。请按照以下步骤操作。
第一步尝试 1. 禁用并停止 WMI 服务。A。sc config winmgmt start= 已禁用 净停止 winmgmt
运行以下命令。A。Winmgmt /salvagerepository %windir%\System32\wbem b. Winmgmt /resetrepository %windir%\System32\wbem
重新启用 WMI 服务,然后重新启动服务器以查看情况。A。sc 配置 winmgmt 启动 = 自动
如果问题仍然存在,请尝试以下步骤来重建存储库:
禁用并停止 WMI 服务。A。sc config winmgmt start=disabled(注意“=”和“disabled”之间有一个空格)净停止 winmgmt
将存储库文件夹(位于 %windir%\System32\wbem\repository)重命名为repository.old。
重新启用 WMI 服务。A。sc 配置 winmgmt 启动 = 自动
重新启动服务器以查看问题是否仍然存在。
如果问题仍然存在,请尝试以下步骤重新注册所有 dll,并重新编译 wbem 文件夹中的 .mofs,并重新注册 WMI 服务和提供程序。您可以通过保存到 txt 文件然后重命名为 .bat 并使用管理员权限从命令提示符运行并将焦点更改到以下目录来使用以下脚本:C:\Windows\System32\Wbem。@echo off sc config winmgmt start= 禁用 net stop winmgmt /y %systemdrive% cd %windir%\system32\wbem for /f %%s in ('dir /b *.dll') do regsvr32 /s % wmiprvse /regserver winmgmt /regserver sc config winmgmt start= 自动网络启动 winmgmt for /f %s in ('dir /s /b *.mof *.mfl') do mofcomp %s b. 重新启动计算机并测试 WMI 警告:重建 WMI 存储库已导致某些 3rd 方产品无法工作,直到重新运行其设置并将其 MOF 重新添加回存储库为止。
如果 /salvagerepository 或 /resetrepository 无法解决问题,则手动重建存储库: 1. 将启动类型更改为 Window Management Instrumentation (WMI) 服务并禁用 2. 停止 WMI 服务;您可能需要先停止 IP Helper Service 或其他相关服务,然后才能停止 WMI 服务 3. 将存储库文件夹重命名为:C:\WINDOWS\system32\wbem\Repository 为 Repository.old 4. 打开具有提升权限的 CMD 提示符5. CD C:\windows\system32\wbem 6. for /f %s in ('dir /b /s *.dll') do regsvr32 /s %s 7. 将 WMI 服务类型设置回自动并启动WMI服务 8. cd /dc:\ ((到c盘根目录,这个很重要)) 9. for /f %s in ('dir /s /b *.mof *.mfl') do mofcomp %s 10. 重新启动服务器
Win2012 可能的修复。转至 C:\WINDOWS\system32\wbem\ 将存储库重命名为 Repository.old 找到 WMI 损坏之前日期的 Repository.xxx 文件夹,并将其重命名为 Repository。重启服务器
| 归档时间: |
|
| 查看次数: |
185 次 |
| 最近记录: |