-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMove-Content.ps1
More file actions
49 lines (40 loc) · 1.35 KB
/
Move-Content.ps1
File metadata and controls
49 lines (40 loc) · 1.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
function Move-Content {
[CmdletBinding()]
param (
[Parameter(ValueFromPipelineByPropertyName = $True)]
[String]
$From,
[Parameter(ValueFromPipelineByPropertyName = $True)]
[String]
$To,
[Parameter(ValueFromPipelineByPropertyName = $True)]
[String]
$Path,
[Parameter(ValueFromPipelineByPropertyName = $True)]
[String]
$ToPath
)
begin {
}
process {
$f = $aemEnv | Where-Object -Property name -Value $From -eq
$t = $aemEnv | Where-Object -Property name -Value $To -eq
if (($f -eq $null) -or ($t -eq $null)) {
Write-Error -Message "Servers not not found."
return;
}
$fcred = "$($f.username)" + ":" + "$($f.password)"
$tcred = $($t.username) + ":" + "$($t.password)"
$furl = $f.url.Substring($f.url.LastIndexOf('/') + 1);
$turl = $t.url.Substring($t.url.LastIndexOf('/') + 1);
if ($ToPath) {
$command = "vlt rcp http://$fcred@$($furl)/crx/-/jcr:root$path http://$tcred@$($turl)/crx/-/jcr:root$ToPath -u -r -b 100"
}
else {
$command = "vlt rcp http://$fcred@$($frul)/crx/-/jcr:root$path http://$tcred@$($turl)/crx/-/jcr:root$path -u -r -b 100"
}
iex $command
}
end {
}
}