Want SYSVOL state post FRS>DFSR migration


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?


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%'"

Thank you kvprasoon