Public const UInt32 SYNCHRONIZE = 0x00100000 Public const UInt32 WRITE_OWNER = 0x00080000 Public const UInt32 WRITE_DAC = 0x00040000 Public const UInt32 READ_CONTROL = 0x00020000
Write-Host -NoNewLine "Running as Administrator." # Exit from the current, unelevated, process # Indicate that the process should be elevated $newProcess.Arguments = $myInvocation.M圜ommand.Definition # Specify the current script path and name as a parameter # Create a new process object that starts PowerShell # We are not running "as Administrator" - so relaunch as administrator #$Host.UI.RawUI.BackgroundColor = "Black" $Host.UI.RawUI.WindowTitle = $myInvocation.M圜ommand.Definition + "(Elevated)" # We are running "as Administrator" - so change the title and background color to indicate this If ($myWindowsPrincipal.IsInRole($adminRole)) # Check to see if we are currently running "as Administrator" # Get the security principal for the Administrator role $myWindowsPrincipal=new-object ($myWindowsID) # Get the ID and security principal of the current user account $robocopySwitches="/TBD /FFT /NS /NC /NDL /S /E /COPY:DATS /DCOPY:T /PURGE /MIR /B /NP /XO /XJF /XJD /R:0 /W:0 $log" #$robocopySwitches="/TBD /FFT /NS /NC /NDL /S /E /COPY:DATS /DCOPY:T /PURGE /MIR /NP /XO /XJF /XJD /R:0 /W:0 $log" $quickEmcopySwitches="/de /s /purge /r:0 /w:0 /c $log" $emcopySwitches="/o /secforce /d /c /r:0 /w:0 /th 32 /s /purge /sdd /stream $log" $pathErrorsLog="$logPath`\$hostname-path-errors-log-$dateStamp.txt" $lockedFilesReport="$logPath`\$hostname-locked-files-log-$dateStamp.txt" $errorsLogFile="$logPath`\$hostname-filecopy-errors-$dateStamp.txt" $logPath="$scriptPath`\filecopy_logs\$hostname"
$dateStamp = Get-Date -Format "yyyy-MM-dd-hhmmss" # Using System.Array Object constructor to create a two dimensional # Clustername indicates that this source is part of a Microsoft failover # Clustername = $null means that this item is originating from a standalone file server # Specify Sources (LFS) and Destinations (UNC) The script below is for informational purposes.