Invoke-Command HRESULT 0x80072020

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

This topic contains 0 replies, has 1 voice, and was last updated by  dave20012335 2 weeks, 2 days ago.

  • Author
    Posts
  • #174727

    Participant
    Topics: 1
    Replies: 0
    Points: 14
    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
    

You must be logged in to reply to this topic.