J'ai la fonction suivante à robocopy
(miroir) fichiers de $sourcepath
à $targetPath
et fonctionne très bien. Comment vais-je atteindre la même chose si la machine $targetPath
est dans un autre domaine?Comment voler le dossier entre 2 serveurs dans différents domaines?
-à-dire SourceServer - Domain1, targetserver - Domaine2
function evpcopy {
begin {
#Recommended options
$switchNP = "/NP" #No Progress - don't display percentage copied
#Copy options
$switchMIR = "/MIR" #MIRror a directory tree (equivalent to /E plus /PURGE)
$switchR = "/R:3" #number of Retries on failed copies: default 1 million
$switchW = "/W:1" #Wait time between retries: default is 30 seconds
$sourcePath = '\\sourceServer\d$\EVP'
$targetPath = '\\targetServer\d$\EVP'
#Log File Function
$InputLogFile = 'D:\logs'
if (!(Test-Path -Path $InputLogFile)) {
Write-EventLog -LogName Application -source EvpScript -EventId 1234 -message "path $InputLogFile doesn't exist! `n"
}
$logfile = $InputLogFile + "\" + ((Get-Date).ToString('yyyy-MM-dd')) + "_" + $sourcePath.Split('\')[-1].Replace(" ", "_") + ".txt"
$switchlogfile = "/TEE", "/LOG+:$logfile"
}
process {
$run = robocopy.exe $sourcePath $targetPath $switchNP $switchR $switchW $switchMIR $switchlogfile |
foreach { $ErrorActionPreference = "silentlycontinue" }
}
end {}
} #end robocopy function
evpcopy
Peut-être que vous utilisez un 'PSSession'? https://technet.microsoft.com/en-us/library/hh849707.aspx – ne1410s