Active Directory - Creating Install From Media dump
發行項
function Backup-ActiveDirectoryIFM
{
param (
[string]$IFMPath,
[switch]$NoDefrag
)
$errorAction = 'stop'
$minimumFreeSpace = 0.5TB
$Mode = 'Full'
if (!$IFMPath)
{
$driveObject = Get-PSDrive |
? {
$_.Free
} |
Sort-Object -Descending Free |
Select-Object -First 1
if ($driveObject.Free -lt $minimumFreeSpace)
{
Write-Error "Drive with largest free space $($driveObject.Name): has only $([int]($driveObject.Free/1GB))GB free, which is less than the required minimum of $([int]($minimumFreeSpace/1GB))GB."
}
$now = Get-Date
$todayString = $now.ToString('yyyy-MM-dd')
$IFMPath = "E:\NTDS_$todayString" ## This is where the IFM media set will be created
}
if ($noDefrag)
{
$NoDefragString = 'NoDefrag'
}
Write-Progress -Activity "Create IFM $NoDefragString" -Status $IFMPath
ntdsutil.exe 'activate instance ntds' ifm "create sysvol $Mode $NoDefragString $IFMPath" q q q |
Tee-Object -Variable IFMResult
$global:__IFMResult = $IFMResult
}
Comments
Anonymous
November 30, 2015
Hm. Can't edit it, nor unpublish it. Wanted to add cred where credit is due:
blogs.metcorpconsulting.com/tech