PSP-Inventory icon indicating copy to clipboard operation
PSP-Inventory copied to clipboard

[FEATURE] - Better errorhandling for machine with SPN configured

Open powershellpr0mpt opened this issue 6 years ago • 0 comments

Is your feature request related to a problem? Please describe. Getting an ugly error when running into machines that have SPN configured, causing WinRM to not always function properly

Get-CimInstance : WinRM cannot process the request. The following error with errorcode 0x80090322 occurred while using Kerberos 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.
At C:\Program Files\WindowsPowerShell\Modules\PSP-Inventory\1.0.7\Public\Get-PspLocalUser.ps1:64 char:36
+ ... mainRole = (Get-CimInstance -ComputerName $Computer -ClassName Win32_ ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : AuthenticationError: (:) [Get-CimInstance], CimException
    + FullyQualifiedErrorId : HRESULT 0x8033809d,Microsoft.Management.Infrastructure.CimCmdlets.GetCimInstanceCommand
    + PSComputerName        : <computer> `

Describe the solution you'd like Nicer error handling, for example Write-Error "[$Computer] - Unable to remote to machine, please check SPN before retrying"

powershellpr0mpt avatar Mar 19 '19 13:03 powershellpr0mpt