Want SYSVOL state post FRS>DFSR migration

Welcome Forums General PowerShell Q&A Want SYSVOL state post FRS>DFSR migration

This topic contains 2 replies, has 2 voices, and was last updated by

 
Participant
1 month, 2 weeks ago.

  • Author
    Posts
  • #121368

    Participant
    Points: 71
    Rank: Member

    Hello,

    I have cobbled this script to try and get the current Net Share of SYSVOl after my dfsr migration. I just want a (Powershell) alternative to dfsrmig /getglobalstate as some of our DCs are behind firewalls and PS is able to go where Windows APIs are not allowed.

    $DCs = Get-ADDomainController -Server corp.com -Filter * | sort hostname |
        select -Property hostname -ExpandProperty hostname
    }
    
    $dc = New-PSSession -ComputerName $DCs -Credential Get-Credential
    
    Invoke-Command -Session $dc {
        net share }
    }
    

    This works but I can't see the hostname, as expected. After running GM after my Invoke-Command, I see PSComputerName as a property, but then when I tried:

    Invoke-Command -Session $dc {net share} | select "Share name", Resource, PSComputerName

    I had empty results.

    I thought I would even try to get fancy but failed miserably:

    Invoke-Command -Session $dc {
        net share | ?{$_."Share Name" -Like "*SYSVOL*"}

    Can you help me massage this to show the SYSVOL path and the hostname?

    Thanks

  • #121399

    Participant
    Points: 884
    Helping Hand
    Rank: Major Contributor

    net is a native executable and outputs text not objects, hence you can't do Select 'Share Name'.
    You could use CIM here.

    Get-CimInstance -ClassName win32_share -ComputerName $Server -Filter "Name like '%Sys%'"
    
    • #121413

      Participant
      Points: 71
      Rank: Member

      Thank you kvprasoon

You must be logged in to reply to this topic.