Invoke-Command HRESULT 0x80072020

Welcome Forums General PowerShell Q&A Invoke-Command HRESULT 0x80072020

Viewing 0 reply threads
  • Author
    Posts
    • #174727
      Participant
      Topics: 1
      Replies: 0
      Points: 15
      Rank: Member

      Hi All,

      I am trying the run an invoke command using domain credentials to query a list of GPOs. The error is

      An operations error occurred. (Exception from HRESULT: 0x80072020)
      + CategoryInfo : NotSpecified: (:) [Get-GPO], COMException
      + FullyQualifiedErrorId : System.Runtime.InteropServices.COMException,Microsoft.GroupPolicy.Commands.GetGpoCommand
      + PSComputerName : localhost
      
      And the code is below
      
      $job = Invoke-Command -ComputerName localhost -ArgumentList $DomainOU -ScriptBlock {
      Import-Module GroupPolicy ;
      $DomainFqdn = [System.DirectoryServices.ActiveDirectory.Domain]::GetCurrentDomain() ;
      $dctx = New-Object System.DirectoryServices.ActiveDirectory.DirectoryContext -ArgumentList "Domain",$DomainFqdn ;
      $DomainController = [System.DirectoryServices.ActiveDirectory.DomainController]::FindOne($dctx) ;
      
      Get-GPO -All -Domain $DomainFqdn.Name -Server $DomainController.Name
      
      } -asJob -Credential $credential
      wait-job -id $job.Id
      Receive-Job $job.Id
      
Viewing 0 reply threads
  • The topic ‘Invoke-Command HRESULT 0x80072020’ is closed to new replies.