$servername = "xxxxxxxxxxxxxxxxxxxxx"
$username = "xxxxxxxxx"
$password = "xxxxxxxxxxxxx"
$port = 22
$foldername = @("HueScripts","completereload")
Import-Module SSH-Sessions
New-SshSession -ComputerName $servername -Username $username -Password $password -Port $port
foreach ($f in $foldername) {
$command1 = "test -d `"/home/brillio/$f`" && sudo rm -R /home/brillio/$f || echo Does Not Exist Proceeding..."
$SshResults1 = Invoke-SshCommand -InvokeOnAll -Command $command1
$command2 = "sudo mkdir /home/brillio/$f"
$SshResults2 = Invoke-SshCommand -InvokeOnAll -Command $command2
$command3 = "sudo chmod -R 777 /home/brillio/$f"
$SshResults3 = Invoke-SshCommand -InvokeOnAll -Command $command3
$command4 = "hadoop fs -copyToLocal wasb://xxxxxxx@xxxxxxxxxxx/$f/* /home/brillio/$f/"
$SshResults4 = Invoke-SshCommand -InvokeOnAll -Command $command4
$command5 = "sudo chmod -R 777 /home/brillio/$f"
$SshResults5 = Invoke-SshCommand -InvokeOnAll -Command $command5
Write-Host "Done $f"
}
$command6 = "/home/brillio/hueurl.sh"
$SshResults6 = Invoke-SshCommand -InvokeOnAll -Command $command6
Remove-SshSession -RemoveAll
$username = "xxxxxxxxx"
$password = "xxxxxxxxxxxxx"
$port = 22
$foldername = @("HueScripts","completereload")
Import-Module SSH-Sessions
New-SshSession -ComputerName $servername -Username $username -Password $password -Port $port
foreach ($f in $foldername) {
$command1 = "test -d `"/home/brillio/$f`" && sudo rm -R /home/brillio/$f || echo Does Not Exist Proceeding..."
$SshResults1 = Invoke-SshCommand -InvokeOnAll -Command $command1
$command2 = "sudo mkdir /home/brillio/$f"
$SshResults2 = Invoke-SshCommand -InvokeOnAll -Command $command2
$command3 = "sudo chmod -R 777 /home/brillio/$f"
$SshResults3 = Invoke-SshCommand -InvokeOnAll -Command $command3
$command4 = "hadoop fs -copyToLocal wasb://xxxxxxx@xxxxxxxxxxx/$f/* /home/brillio/$f/"
$SshResults4 = Invoke-SshCommand -InvokeOnAll -Command $command4
$command5 = "sudo chmod -R 777 /home/brillio/$f"
$SshResults5 = Invoke-SshCommand -InvokeOnAll -Command $command5
Write-Host "Done $f"
}
$command6 = "/home/brillio/hueurl.sh"
$SshResults6 = Invoke-SshCommand -InvokeOnAll -Command $command6
Remove-SshSession -RemoveAll
No comments:
Post a Comment