Files
Compose-Files/Backups/Miker/.trash/Recovery SYSVOL Scripts 2.md
T
2026-07-20 09:23:17 -04:00

2.7 KiB

Create D:\Windows\SYSVOL\Staging Areas\ad.cbp.dhs.gov
new-item -path D:\Windows\SYSVOL -ItemType directory -name "staging areas"
new-psdrive -name junction -PSProvider FileSystem -root \tnwg01a-v0834\Junction
Set-Location "D:\Windows\SYSVOL\Staging Areas"
Junction:\junction.exe "ad.cbp.dhs.gov" "d:\windows\sysvol\staging" -nobanner -accepteula
Remove-PSDrive -name junction
 
 
Create D:\Windows\sysvol\domain \ad.cbp.dhs.gov
new-psdrive -name junction -PSProvider FileSystem -root \tnwg01a-v0834\Junction
Set-Location D:\Windows\SYSVOL\sysvol
Junction:\junction.exe "ad.cbp.dhs.gov" "D:\Windows\sysvol\domain" -nobanner -accepteula
Remove-PSDrive -name junction
 
Install RSAT-File-Services and RSAT-DFS-Mgmt-Con
Get-WindowsFeature RSAT-DFS-Mgmt-Con
$RSATDFS = Get-WindowsFeature RSAT-File-Services -ErrorAction SilentlyContinue
if (($RSATDFS).installstate -eq "Available")
{ Import-Module ServerManager
Install-WindowsFeature RSAT-DFS-Mgmt-Con
}
 
$RSATDFS2 = Get-WindowsFeature RSAT-DFS-Mgmt-Con -ErrorAction SilentlyContinue
if (($RSATDFS2).installstate -eq "Available")
{
Import-Module ServerManager
Install-WindowsFeature RSAT-DFS-Mgmt-Con
 
}
 
 
Stop Service and set to disable
$servicename = 'DFSR'
$service = Get-Service $servicename
if ($service.Status -eq 'Running') {
$service | net stop dfsr
}
if ($service.StartType -eq 'Automatic') {
$service | Set-Service -StartupType Disabled
}
 
Delete DFSR Database
Get-ChildItem -directory "D:\System Volume Information\DFSR" | Remove-Item -Force -Recurse
 
Server Restart
Restart-Computer -Force
 
 
Start Service and set to Automatic
$servicename = 'DFSR'
$service = Get-Service $servicename
if ($service.Status -ne 'Started') {
$service | net start dfsr
}
if ($service.StartType -ne 'Automatic') {
$service | Set-Service -StartupType Automatic
}
 
DFSR State
This must be run on domain controllers.
$status = Wmic /namespace:\root\microsoftdfs path dfsrreplicatedfolderinfo get replicationgroupname,replicatedfoldername,state
"$($env:COMPUTERNAME) state $(($status -split "Domain System Volume ")[3])"
 
 
Check SYSVOL

$list
 
=
 Get-ADDomainController 
-
filter
 
*
 
|
 
Select-Object
 name 
|
 
Sort-Object
 name

$list
.count






 = Get-ADDomainController -filter * | Select-Object name | Sort-Object name
$list.count
 
Neil Razzano
Department of Homeland Security/U.S. Customs & Border Protection
Windows Services Group (WSG)
Data Center Operations (DCO) | EDCOG | EIOD
Office 703-921-6061 | Cell 703-843-1532