Fetch the repository succeeded.
This action will force synchronization from chuanjiao10/kasini3000, which will overwrite any changes that you have made since you forked the repository, and can not be recovered!!!
Synchronous operation will process in the background and will refresh the page when finishing processing. Please be patient.
#建议保存编码为:bom头 + utf8
param
(
[Alias("ipaddress")][String]${被控机ip地址} = $global:当前被控机_ip.ip,
[Alias("port")][uint16]$端口 = $global:当前被控机_ip.端口,
[String]$LiteralPath,
[String]$Path,
[ValidateNotNullOrEmpty()]
[String]$Destination,
[Switch]$Recurse,
#缩水封装
[String[]]$Exclude #源目录,需要使用【-path】和【*】才灵。如: -path 'd:\xxx\*'
)
if (($LiteralPath -eq '') -and ($Path -eq ''))
{
if ($env:LANG -eq 'zh_CN.UTF-8')
{
Write-Error "错误:源文件,源目录为空。退出码6"
}
else
{
Write-Error "error:Source file, or source directory is empty .exit 6"
}
exit 6
}
if (($LiteralPath -ne '') -and ($Path -ne ''))
{
if ($env:LANG -eq 'zh_CN.UTF-8')
{
Write-Error "错误:-LiteralPath,-Path,只能输入其一。退出码7"
}
else
{
Write-Error "error:-LiteralPath,-Path,Only one of them can be entered .exit 7"
}
exit 7
}
if ( ($IsWindows -eq $True) -or ($PSVersionTable.psversion.major -lt 6) ) #win
{
& 'c:\ProgramData\kasini3000\0k_source.ps1'
}
if ($IsLinux -eq $True)
{
& '/etc/kasini3000/0k_source.ps1'
}
Write-Verbose '从主控机到被控机,复制文件开始'
& 'zd只读nodelist文件.ps1'
$private:当前被控机 = $global:所有被控机 | Where-Object { $_.ip -eq ${被控机ip地址} }
if ($private:当前被控机.ip -ne ${被控机ip地址})
{
if ($env:LANG -eq 'zh_CN.UTF-8')
{
Write-Error "nodelist文件中找不到这个ip地址: ${被控机ip地址} ,错误码11"
}
else
{
Write-Error "NODE IP was not found in the NODELIST file: ${被控机ip地址} ,error code 11"
}
$private:当前被控机.'被控机os类型' = '错误:nodelist文件中找不到这个ip地址'
exit 11
}
if ($LiteralPath -eq '')
{
if (Test-Path -Path $Path)
{
}
else
{
Write-Error "错误:找不到源文件,或源目录。退出码4"
exit 4
}
}
else
{
if (Test-Path -Path $LiteralPath)
{
}
else
{
Write-Error "错误:找不到源文件,或源目录。退出码4"
exit 4
}
}
$win = 'win7','win8','win10','win11','win2008r2','win2012r2','win2016','win2019','win2022'
$linux = & "${PSScriptRoot}/linux_distribution_str.ps1"
$all = $win + $linux
Write-Verbose $private:当前被控机.被控机os类型
Write-Verbose $private:当前被控机.ip
function 随机延时1
{
$毫秒1 = 280,280,280,310,310,310,370,370,370,390,390,390,450,450,570,570,590,630
$延时1 = Get-Random -InputObject $毫秒1
Write-Verbose "延时 $延时1"
Start-Sleep -Milliseconds $延时1
}
if ($private:当前被控机.被控机os类型 -notin $all)
{
& 'sx1刷新单个被控机对象的_os类型属性.ps1' -被控机ip地址 $private:当前被控机.ip
}
Write-Verbose $private:当前被控机.被控机os类型
if ($private:当前被控机.被控机os类型 -notin $all)
{
Write-Error ("错误:当前被控机【{0}】,【端口不通】或【账户密码不对】。任务无法运行。退出码24" -f $private:当前被控机.ip)
exit 24
}
if ( ($IsWindows -eq $True) -or ($PSVersionTable.psversion.major -lt 6) ) #win
{
if ( $private:当前被控机.被控机os类型 -in $win)
{
if ( ($端口 -eq '') -or ($端口 -eq $null) )
{
$端口 = 5985
}
try
{
$null = Test-WSMan -ComputerName ${被控机ip地址} -Port $端口 -ErrorAction stop
}
catch
{
if ($env:LANG -eq 'zh_CN.UTF-8')
{
Write-Error "错误:目的ip地址【${被控机ip地址}】端口不通。错误码22"
}
else
{
Write-Error "error:node port closed :【${被控机ip地址}】.exit 22"
}
exit 22
}
finally
{
}
$PSRemoting服务器用户名 = $private:当前被控机.用户名
$用户名2 = "${被控机ip地址}\${PSRemoting服务器用户名}"
$密码明文 = $private:当前被控机.当前密码
$密码密文 = ConvertTo-SecureString $密码明文 -AsPlainText -Force
$用户名和密码捆绑后的授权信息 = New-Object System.Management.Automation.PSCredential ($用户名2,$密码密文)
Write-Verbose '使用密码,连接w2w5985开始'
$private:连接3 = New-PSSession -ComputerName ${被控机ip地址} -Port $端口 -Credential $用户名和密码捆绑后的授权信息
if ($private:连接3 -eq $null)
{
if ($env:LANG -eq 'zh_CN.UTF-8')
{
Write-Error "错误:使用密码,在${被控机ip地址}上连接w2w5985失败。退出码21"
}
else
{
Write-Error "error:Connection failed: ${被控机ip地址} .exit 21"
}
exit 21
}
Write-Verbose '连接成功。现在开始测试Destination目录存在否:'
$Destination存在否 = Invoke-Command -Session $private:连接3 -ScriptBlock { Test-Path $args[0] } -ArgumentList $Destination
if ($Destination存在否 -eq $true)
{
}
else
{
Remove-PSSession -Session $private:连接3
if ($env:LANG -eq 'zh_CN.UTF-8')
{
Write-Error "错误:找不到目标目录。错误码5"
}
else
{
Write-Error "error:The target directory could not be found.exit 5"
}
exit 5
}
Write-Verbose '连接成功。现在开始复制文件:'
if ($LiteralPath -eq '')
{
if ($Exclude -eq $null)
{
try
{
if ($Recurse -eq $True)
{
Copy-Item -ToSession $private:连接3 -Path $Path -Destination $Destination -Force -Recurse
}
else
{
Copy-Item -ToSession $private:连接3 -Path $Path -Destination $Destination -Force
}
}
catch
{
$private:复制出错 = $true
随机延时1
if ($Recurse -eq $True)
{
Copy-Item -ToSession $private:连接3 -Path $Path -Destination $Destination -Force -Recurse
}
else
{
Copy-Item -ToSession $private:连接3 -Path $Path -Destination $Destination -Force
}
}
}
else
{
try
{
if ($Recurse -eq $True)
{
Copy-Item -ToSession $private:连接3 -Path $Path -Destination $Destination -Force -Recurse -Exclude $Exclude
}
else
{
Copy-Item -ToSession $private:连接3 -Path $Path -Destination $Destination -Force -Exclude $Exclude
}
}
catch
{
$private:复制出错 = $true
随机延时1
if ($Recurse -eq $True)
{
Copy-Item -ToSession $private:连接3 -Path $Path -Destination $Destination -Force -Recurse -Exclude $Exclude
}
else
{
Copy-Item -ToSession $private:连接3 -Path $Path -Destination $Destination -Force -Exclude $Exclude
}
}
}
}
else
{
try
{
if ($Recurse -eq $True)
{
Copy-Item -ToSession $private:连接3 -LiteralPath $LiteralPath -Destination $Destination -Force -Recurse
}
else
{
Copy-Item -ToSession $private:连接3 -LiteralPath $LiteralPath -Destination $Destination -Force
}
}
catch
{
$private:复制出错 = $true
随机延时1
if ($Recurse -eq $True)
{
Copy-Item -ToSession $private:连接3 -LiteralPath $LiteralPath -Destination $Destination -Force -Recurse
}
else
{
Copy-Item -ToSession $private:连接3 -LiteralPath $LiteralPath -Destination $Destination -Force
}
}
}
Write-Verbose '复制文件完成,即将断开连接。'
Remove-PSSession -Session $private:连接3
}
if ( $private:当前被控机.被控机os类型 -in $linux)
{
if ( $PSVersionTable.psversion.major -ge 6)
{
}
else
{
if ($env:LANG -eq 'zh_CN.UTF-8')
{
Write-Error "错误:在win中连接linux,依赖powershell 6,或以上版本。错误码12"
}
else
{
Write-Error "error:need powershell version 6 or higher.exit 12"
}
exit 12
}
if ( ($端口 -eq '') -or ($端口 -eq $null) )
{
$端口 = 22
}
Write-Verbose '使用ssh秘钥1,连接w2l开始'
[string]$private:temp011 = ssh.exe -l root -i "$env:USERPROFILE\.ssh\id_rsa" ${被控机ip地址} -p $端口 -o PasswordAuthentication=no 'date' *>&1
Write-Verbose $private:temp011
if ( $private:temp011.ToLower().Contains('Permission denied'.ToLower()) )
{
$秘钥1连接成功 = $false
if ($env:LANG -eq 'zh_CN.UTF-8')
{
Write-Verbose "错误:使用ssh秘钥1,在${被控机ip地址}上连接w2l失败"
}
else
{
Write-Verbose "error:ssh-key-file1 login failed:${被控机ip地址}"
}
}
else
{
$秘钥1连接成功 = $true
}
if ( $private:temp011.ToLower().Contains('timed out'.ToLower()) )
{
if ($env:LANG -eq 'zh_CN.UTF-8')
{
Write-Error "错误:使用ssh秘钥1,在${被控机ip地址}上w2l连接超时。退出码13"
}
else
{
Write-Error "error:ssh-key-file1 login timeout: ${被控机ip地址} .exit 13"
}
exit 13
}
if ($秘钥1连接成功 -eq $true)
{
$private:连接1 = New-PSSession -HostName ${被控机ip地址} -Port $端口 -UserName root -KeyFilePath "$env:USERPROFILE\.ssh\id_rsa"
Write-Verbose '连接成功。现在开始测试Destination目录存在否:'
$Destination存在否 = Invoke-Command -Session $private:连接1 -ScriptBlock { Test-Path $args[0] } -ArgumentList $Destination
if ($Destination存在否 -eq $true)
{
}
else
{
Remove-PSSession -Session $private:连接1
if ($env:LANG -eq 'zh_CN.UTF-8')
{
Write-Error "错误:找不到目标目录。错误码5"
}
else
{
Write-Error "error:The target directory could not be found.exit 5"
}
exit 5
}
Write-Verbose '【连接1】连接成功。现在开始复制文件:'
if ($LiteralPath -eq '')
{
if ($Exclude -eq $null)
{
try
{
if ($Recurse -eq $True)
{
#$env:LANG = 'en_US.UTF-8'
Copy-Item -ToSession $private:连接1 -Path $Path -Destination $Destination -Force -Recurse
}
else
{
#$env:LANG = 'en_US.UTF-8'
Copy-Item -ToSession $private:连接1 -Path $Path -Destination $Destination -Force
}
}
catch
{
$private:复制出错 = $true
随机延时1
if ($Recurse -eq $True)
{
#$env:LANG = 'en_US.UTF-8'
Copy-Item -ToSession $private:连接1 -Path $Path -Destination $Destination -Force -Recurse
}
else
{
#$env:LANG = 'en_US.UTF-8'
Copy-Item -ToSession $private:连接1 -Path $Path -Destination $Destination -Force
}
}
}
else
{
try
{
if ($Recurse -eq $True)
{
#$env:LANG = 'en_US.UTF-8'
Copy-Item -ToSession $private:连接1 -Path $Path -Destination $Destination -Force -Recurse -Exclude $Exclude
}
else
{
#$env:LANG = 'en_US.UTF-8'
Copy-Item -ToSession $private:连接1 -Path $Path -Destination $Destination -Force -Exclude $Exclude
}
}
catch
{
$private:复制出错 = $true
随机延时1
if ($Recurse -eq $True)
{
#$env:LANG = 'en_US.UTF-8'
Copy-Item -ToSession $private:连接1 -Path $Path -Destination $Destination -Force -Recurse -Exclude $Exclude
}
else
{
#$env:LANG = 'en_US.UTF-8'
Copy-Item -ToSession $private:连接1 -Path $Path -Destination $Destination -Force -Exclude $Exclude
}
}
}
}
else
{
try
{
if ($Recurse -eq $True)
{
#$env:LANG = 'en_US.UTF-8'
Copy-Item -ToSession $private:连接1 -LiteralPath $LiteralPath -Destination $Destination -Force -Recurse
}
else
{
#$env:LANG = 'en_US.UTF-8'
Copy-Item -ToSession $private:连接1 -LiteralPath $LiteralPath -Destination $Destination -Force
}
}
catch
{
$private:复制出错 = $true
随机延时1
if ($Recurse -eq $True)
{
#$env:LANG = 'en_US.UTF-8'
Copy-Item -ToSession $private:连接1 -LiteralPath $LiteralPath -Destination $Destination -Force -Recurse
}
else
{
#$env:LANG = 'en_US.UTF-8'
Copy-Item -ToSession $private:连接1 -LiteralPath $LiteralPath -Destination $Destination -Force
}
}
}
Write-Verbose '【连接1】复制文件完成,即将断开连接。'
Remove-PSSession -Session $private:连接1
Start-Sleep -Seconds 1
}
else
{
Write-Verbose '使用ssh秘钥2,连接w2l开始'
[string]$private:temp012 = ssh.exe -l root -i "${global:kasini3000_data_path}\ssh_key_files_old1\id_rsa" ${被控机ip地址} -p $端口 -o PasswordAuthentication=no 'date' *>&1
Write-Verbose $private:temp012
if ( $private:temp012.ToLower().Contains('Permission denied'.ToLower()) )
{
if ($env:LANG -eq 'zh_CN.UTF-8')
{
Write-Error "错误:使用ssh秘钥2,在${被控机ip地址}上连接w2l失败。错误码15"
}
else
{
Write-Error "error:ssh-key-file2 login failed${被控机ip地址}.exit 15"
}
exit 15
}
$private:连接2 = New-PSSession -HostName ${被控机ip地址} -Port $端口 -UserName root -KeyFilePath "${global:kasini3000_data_path}\ssh_key_files_old1\id_rsa"
$Destination存在否 = Invoke-Command -Session $private:连接2 -ScriptBlock { Test-Path $args[0] } -ArgumentList $Destination
if ($Destination存在否 -eq $true)
{
}
else
{
Remove-PSSession -Session $private:连接2
if ($env:LANG -eq 'zh_CN.UTF-8')
{
Write-Error "错误:找不到目标目录。错误码5"
}
else
{
Write-Error "error:The target directory could not be found.exit 5"
}
exit 5
}
Write-Verbose '【连接2】连接成功。现在开始复制文件:'
if ($LiteralPath -eq '')
{
if ($Exclude -eq $null)
{
try
{
if ($Recurse -eq $True)
{
#$env:LANG = 'en_US.UTF-8'
Copy-Item -ToSession $private:连接2 -Path $Path -Destination $Destination -Force -Recurse
}
else
{
#$env:LANG = 'en_US.UTF-8'
Copy-Item -ToSession $private:连接2 -Path $Path -Destination $Destination -Force
}
}
catch
{
$private:复制出错 = $true
随机延时1
if ($Recurse -eq $True)
{
#$env:LANG = 'en_US.UTF-8'
Copy-Item -ToSession $private:连接2 -Path $Path -Destination $Destination -Force -Recurse
}
else
{
#$env:LANG = 'en_US.UTF-8'
Copy-Item -ToSession $private:连接2 -Path $Path -Destination $Destination -Force
}
}
}
else
{
try
{
if ($Recurse -eq $True)
{
#$env:LANG = 'en_US.UTF-8'
Copy-Item -ToSession $private:连接2 -Path $Path -Destination $Destination -Force -Recurse -Exclude $Exclude
}
else
{
#$env:LANG = 'en_US.UTF-8'
Copy-Item -ToSession $private:连接2 -Path $Path -Destination $Destination -Force -Exclude $Exclude
}
}
catch
{
$private:复制出错 = $true
随机延时1
if ($Recurse -eq $True)
{
#$env:LANG = 'en_US.UTF-8'
Copy-Item -ToSession $private:连接2 -Path $Path -Destination $Destination -Force -Recurse -Exclude $Exclude
}
else
{
#$env:LANG = 'en_US.UTF-8'
Copy-Item -ToSession $private:连接2 -Path $Path -Destination $Destination -Force -Exclude $Exclude
}
}
}
}
else
{
try
{
if ($Recurse -eq $True)
{
#$env:LANG = 'en_US.UTF-8'
Copy-Item -ToSession $private:连接2 -LiteralPath $LiteralPath -Destination $Destination -Force -Recurse
}
else
{
#$env:LANG = 'en_US.UTF-8'
Copy-Item -ToSession $private:连接2 -LiteralPath $LiteralPath -Destination $Destination -Force
}
}
catch
{
$private:复制出错 = $true
随机延时1
if ($Recurse -eq $True)
{
#$env:LANG = 'en_US.UTF-8'
Copy-Item -ToSession $private:连接2 -LiteralPath $LiteralPath -Destination $Destination -Force -Recurse
}
else
{
#$env:LANG = 'en_US.UTF-8'
Copy-Item -ToSession $private:连接2 -LiteralPath $LiteralPath -Destination $Destination -Force
}
}
}
Write-Verbose '【连接2】复制文件完成,即将断开连接。'
Remove-PSSession -Session $private:连接2
Start-Sleep -Seconds 1
}
}
}
#-------------------------------------------------------------------
if ($IsLinux -eq $True)
{
if ( $private:当前被控机.被控机os类型 -in $win)
{
Write-Error "无法从【linux主控机】复制文件到【win被控机】"
exit 3
}
if ( $private:当前被控机.被控机os类型 -in $linux)
{
if ( ($端口 -eq '') -or ($端口 -eq $null) )
{
$端口 = 22
}
Write-Verbose '使用ssh秘钥1,连接l2l开始'
[string]$private:temp011 = ssh -l root -i '/root/.ssh/id_rsa' ${被控机ip地址} -p $端口 -o PasswordAuthentication=no 'date' *>&1
Write-Verbose $private:temp011
if ( $private:temp011.ToLower().Contains('Permission denied'.ToLower()) )
{
$秘钥1连接成功 = $false
if ($env:LANG -eq 'zh_CN.UTF-8')
{
Write-Verbose "错误:使用ssh秘钥1,在${被控机ip地址}上连接l2l失败"
}
else
{
Write-Verbose "error:ssh-key-file1 login failed:${被控机ip地址}"
}
}
else
{
$秘钥1连接成功 = $true
}
if ( $private:temp011.ToLower().Contains('timed out'.ToLower()) )
{
if ($env:LANG -eq 'zh_CN.UTF-8')
{
Write-Error "错误:使用ssh秘钥1,在${被控机ip地址}上l2l连接超时。退出码13"
}
else
{
Write-Error "error:ssh-key-file1 login timeout: ${被控机ip地址} .exit 13"
}
exit 13
}
if ($秘钥1连接成功 -eq $true)
{
$private:连接5 = New-PSSession -HostName ${被控机ip地址} -Port $端口 -UserName root -KeyFilePath '/root/.ssh/id_rsa'
Write-Verbose '连接成功。现在开始测试Destination目录存在否:'
$Destination存在否 = Invoke-Command -Session $private:连接5 -ScriptBlock { Test-Path $args[0] } -ArgumentList $Destination
if ($Destination存在否 -eq $true)
{
}
else
{
Remove-PSSession -Session $private:连接5
if ($env:LANG -eq 'zh_CN.UTF-8')
{
Write-Error "错误:找不到目标目录。错误码5"
}
else
{
Write-Error "error:The target directory could not be found.exit 5"
}
exit 5
}
Write-Verbose '【连接5】连接成功。现在开始复制文件:'
if ($LiteralPath -eq '')
{
if ($Exclude -eq $null)
{
try
{
if ($Recurse -eq $True)
{
#$env:LANG = 'en_US.UTF-8'
Copy-Item -ToSession $private:连接5 -Path $Path -Destination $Destination -Force -Recurse
}
else
{
#$env:LANG = 'en_US.UTF-8'
Copy-Item -ToSession $private:连接5 -Path $Path -Destination $Destination -Force
}
}
catch
{
$private:复制出错 = $true
随机延时1
if ($Recurse -eq $True)
{
#$env:LANG = 'en_US.UTF-8'
Copy-Item -ToSession $private:连接5 -Path $Path -Destination $Destination -Force -Recurse
}
else
{
#$env:LANG = 'en_US.UTF-8'
Copy-Item -ToSession $private:连接5 -Path $Path -Destination $Destination -Force
}
}
}
else
{
try
{
if ($Recurse -eq $True)
{
#$env:LANG = 'en_US.UTF-8'
Copy-Item -ToSession $private:连接5 -Path $Path -Destination $Destination -Force -Recurse -Exclude $Exclude
}
else
{
#$env:LANG = 'en_US.UTF-8'
Copy-Item -ToSession $private:连接5 -Path $Path -Destination $Destination -Force -Exclude $Exclude
}
}
catch
{
$private:复制出错 = $true
随机延时1
if ($Recurse -eq $True)
{
#$env:LANG = 'en_US.UTF-8'
Copy-Item -ToSession $private:连接5 -Path $Path -Destination $Destination -Force -Recurse -Exclude $Exclude
}
else
{
#$env:LANG = 'en_US.UTF-8'
Copy-Item -ToSession $private:连接5 -Path $Path -Destination $Destination -Force -Exclude $Exclude
}
}
}
}
else
{
try
{
if ($Recurse -eq $True)
{
#$env:LANG = 'en_US.UTF-8'
Copy-Item -ToSession $private:连接5 -LiteralPath $LiteralPath -Destination $Destination -Force -Recurse
}
else
{
#$env:LANG = 'en_US.UTF-8'
Copy-Item -ToSession $private:连接5 -LiteralPath $LiteralPath -Destination $Destination -Force
}
}
catch
{
$private:复制出错 = $true
随机延时1
if ($Recurse -eq $True)
{
#$env:LANG = 'en_US.UTF-8'
Copy-Item -ToSession $private:连接5 -LiteralPath $LiteralPath -Destination $Destination -Force -Recurse
}
else
{
#$env:LANG = 'en_US.UTF-8'
Copy-Item -ToSession $private:连接5 -LiteralPath $LiteralPath -Destination $Destination -Force
}
}
}
Write-Verbose '【连接5】复制文件完成,即将断开连接。'
Remove-PSSession -Session $private:连接5
Start-Sleep -Seconds 1
}
else
{
Write-Verbose '使用ssh秘钥2,连接l2l开始'
[string]$private:temp012 = ssh -l root -i "${global:kasini3000_data_path}/ssh_key_files_old1/id_rsa" ${被控机ip地址} -p $端口 -o PasswordAuthentication=no 'date' *>&1
Write-Verbose $private:temp012
if ( $private:temp012.ToLower().Contains('Permission denied'.ToLower()) )
{
if ($env:LANG -eq 'zh_CN.UTF-8')
{
Write-Error "错误:使用ssh秘钥2,在${被控机ip地址}上连接l2l失败。错误码15"
}
else
{
Write-Error "error:ssh-key-file2 login failed${被控机ip地址}.exit 15"
}
exit 15
}
$private:连接6 = New-PSSession -HostName ${被控机ip地址} -Port $端口 -UserName root -KeyFilePath "${global:kasini3000_data_path}/ssh_key_files_old1/id_rsa"
Write-Verbose '连接成功。现在开始测试Destination目录存在否:'
$Destination存在否 = Invoke-Command -Session $private:连接6 -ScriptBlock { Test-Path $args[0] } -ArgumentList $Destination
if ($Destination存在否 -eq $true)
{
}
else
{
Remove-PSSession -Session $private:连接6
if ($env:LANG -eq 'zh_CN.UTF-8')
{
Write-Error "错误:找不到目标目录。错误码5"
}
else
{
Write-Error "error:The target directory could not be found.exit 5"
}
exit 5
}
Write-Verbose '【连接6】连接成功。现在开始复制文件:'
if ($LiteralPath -eq '')
{
if ($Exclude -eq $null)
{
try
{
if ($Recurse -eq $True)
{
#$env:LANG = 'en_US.UTF-8'
Copy-Item -ToSession $private:连接6 -Path $Path -Destination $Destination -Force -Recurse
}
else
{
#$env:LANG = 'en_US.UTF-8'
Copy-Item -ToSession $private:连接6 -Path $Path -Destination $Destination -Force
}
}
catch
{
$private:复制出错 = $true
随机延时1
if ($Recurse -eq $True)
{
#$env:LANG = 'en_US.UTF-8'
Copy-Item -ToSession $private:连接6 -Path $Path -Destination $Destination -Force -Recurse
}
else
{
#$env:LANG = 'en_US.UTF-8'
Copy-Item -ToSession $private:连接6 -Path $Path -Destination $Destination -Force
}
}
}
else
{
try
{
if ($Recurse -eq $True)
{
#$env:LANG = 'en_US.UTF-8'
Copy-Item -ToSession $private:连接6 -Path $Path -Destination $Destination -Force -Recurse -Exclude $Exclude
}
else
{
#$env:LANG = 'en_US.UTF-8'
Copy-Item -ToSession $private:连接6 -Path $Path -Destination $Destination -Force -Exclude $Exclude
}
}
catch
{
$private:复制出错 = $true
随机延时1
if ($Recurse -eq $True)
{
#$env:LANG = 'en_US.UTF-8'
Copy-Item -ToSession $private:连接6 -Path $Path -Destination $Destination -Force -Recurse -Exclude $Exclude
}
else
{
#$env:LANG = 'en_US.UTF-8'
Copy-Item -ToSession $private:连接6 -Path $Path -Destination $Destination -Force -Exclude $Exclude
}
}
}
}
else
{
try
{
if ($Recurse -eq $True)
{
#$env:LANG = 'en_US.UTF-8'
Copy-Item -ToSession $private:连接6 -Path $Path -Destination $Destination -Force -Recurse
}
else
{
#$env:LANG = 'en_US.UTF-8'
Copy-Item -ToSession $private:连接6 -Path $Path -Destination $Destination -Force
}
}
catch
{
$private:复制出错 = $true
随机延时1
if ($Recurse -eq $True)
{
#$env:LANG = 'en_US.UTF-8'
Copy-Item -ToSession $private:连接6 -Path $Path -Destination $Destination -Force -Recurse
}
else
{
#$env:LANG = 'en_US.UTF-8'
Copy-Item -ToSession $private:连接6 -Path $Path -Destination $Destination -Force
}
}
Write-Verbose '【连接6】复制文件完成,即将断开连接。'
Remove-PSSession -Session $private:连接6
Start-Sleep -Seconds 1
}
}
}
}
if ($private:复制出错 -eq $true)
{
if ($env:LANG -eq 'zh_CN.UTF-8')
{
Write-Error "错误:从主控机,向此被控机 ${被控机ip地址} 复制文件失败 。错误码1"
}
else
{
Write-Error "error:failed copy to node: ${被控机ip地址} .exit 1"
}
exit 1
}
Write-Verbose '从主控机到被控机,复制文件完成'
exit 0
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。