Files
marco.locatelli@steamware.net 7f87236961 Accorpamento Progetti Powershell Script
2024-02-21 11:23:47 +01:00

178 lines
4.9 KiB
PowerShell
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Esegue setup versione richiesta di BeamWall da repo Artifacts
Write-Output "-----------------------------"
Write-Output "- EgtBeamWall "
Write-Output "-----------------------------"
Write-Output ""
Write-Output ""
$rPath = "\\10.74.82.50\EgtTech\"
$rUser = "10.74.82.50\Server"
$rPwd = "Dossena"
$zPath = "\\truenas\Artifacts\EgtProg\EgtBEAMWALL"
$zPathC = "\\truenas\Artifacts\EgtProg\EgtBEAMWALL_Config"
$zPathS = "\\truenas\Artifacts\EgtCAM5"
$zPathD = "\\truenas\Artifacts\EgtData"
$zPath5 = "\\truenas\Artifacts\EgtProg\EgtCAM5\Config"
$progPath = "C:\EgtTestProg\EgtBEAMWALL"
$dataPath = "C:\EgtTestData"
$arch64 =""
$branch =""
$APP_NAME = "c:\EgtTestProg\EgtCAM5"
$Folder1 = 'c:\EgtTestProg'
$Folder2 = 'c:\EgtTestData'
"Test to see if folder [$Folder1] exists"
if (Test-Path -Path $Folder1) {
"Prog esiste!"
rm -Recurse $Folder1\*.*
} else {
new-item c:\EgtTestProg\EgtBEAMWALL -itemtype directory
}
if (Test-Path -Path $Folder2) {
"Data esiste!"
rm -Recurse $Folder2\*.*
} else {
new-item c:\EgtTestData\EgtBEAMWALL -itemtype directory
}
if ([System.IO.Directory]::Exists('V:\')) {
"Path exists!"
} else {
$secpasswd = ConvertTo-SecureString "Dossena" -AsPlainText -Force
$mycreds = New-Object System.Management.Automation.PSCredential ("10.74.82.50\Server", $secpasswd)
New-SmbMapping -LocalPath 'V:' -RemotePath '\\10.74.82.50\EgtTech' -Username '10.74.82.50\Server' -Password 'Dossena'
}
if ([System.IO.Directory]::Exists('U:\')) {
"Path exists!"
} else {
$secpasswd = ConvertTo-SecureString "Egalware_24068!" -AsPlainText -Force
$mycreds = New-Object System.Management.Automation.PSCredential ("steamw\egalware", $secpasswd)
New-SmbMapping -LocalPath 'U:' -RemotePath '\\10.74.82.201\Artifacts' -Username 'steamw\egalware' -Password 'Egalware_24068!'
}
$Folder4 = 'c:\EgtTestProg\EgtCAM5'
if (Test-Path -Path $Folder4) {
"EgtCAM5 esiste!"
rm -Recurse $Folder4\*.*
} else {
new-item c:\EgtTestProg\EgtCAM5 -itemtype directory
}
$Folder4v2 = 'c:\EgtTestData\EgtCAM5'
if (Test-Path -Path $Folder4v2) {
"EgtCAM5 esiste!"
rm -Recurse $Folder4v2\*.*
} else {
new-item c:\EgtTestData\EgtCAM5 -itemtype directory
}
function Show-Menu
{
param (
[string]$Title = 'Seleziona Architettura da testare'
)
Clear-Host
Write-Host "================ $Title ================"
Write-Host "1: Premi '1' per 32"
Write-Host "2: Premi '2' per 64"
Write-Host "q: Premi 'q' per uscire dal programma."
}
Show-Menu Title 'Seleziona Architettura da testare'
$selection = Read-Host "Seleziona"
switch ($selection)
{
'1' {
$choiceD = '32'
'Hai scelto 32'
} '2' {
$choiceD = '64'
'Hai scelto 64'
} 'q' {
return
}
}
# function Show-MenuC
#{
# param (
# [string]$Title = 'Seleziona Architettura Librerie C'
# )
# Clear-Host
# Write-Host "================ $Title ================"
#
# Write-Host "1: Premi '1' per 32"
# Write-Host "2: Premi '2' per 64"
# Write-Host "q: Premi 'q' per uscire dal programma."
#}
#
#Show-MenuC Title 'Seleziona Architettura Librerie C'
#
#$selection2 = Read-Host "Seleziona"
# switch ($selection2)
# {
# '1' {
# $choiceC = 'Dll32'
# 'Hai scelto 32'
# } '2' {
# $choiceC = 'Dll64'
# 'Hai scelto 64'
# } 'q' {
# return
# }
# }
if($choiceD -eq '32'){
$choiceC = 'Dll32'
}else {
$choiceC = 'Dll64'
}
#$choiceL = @(Get-ChildItem Z:\EgtProg\LuaLibs\ | Out-GridView -Title 'Scegli architettura Lualibs' -PassThru)
#$choiceC = @(Get-ChildItem Z:\EgtProg\ | Out-GridView -Title 'Scegli architettura Librerie C' -PassThru)
#$choiceD = @(Get-ChildItem U:\EgtData\Beam | Out-GridView -Title 'Scegli architettura Librerie Beam\Wall\BEamWall' -PassThru)
ROBOCOPY /E V:\EgtProg\LuaLibs\$choiceD $dataPath\Lualibs
ROBOCOPY /E V:\EgtProg\$choiceC $APP_NAME
#ROBOCOPY /E Z:\EgtData\Messages $dataPath\EgtBEAMWALL\Config
ROBOCOPY /E V:\EgtProg\EgtCAM5 $Folder4
ROBOCOPY /E U:\EgtCAM5 $Folder4v2
ROBOCOPY /E U:\EgtProg\EgtCAM5\Config $Folder4 DataRoot.ini
ROBOCOPY /E V:\EgtProg\Fonts $Folder4v2\Fonts
ROBOCOPY /E V:\EgtProg\LuaLibs\$choiceD $Folder4v2\Lualibs
#ROBOCOPY /E \\EGALTECHSERVER\EgtTech\EgtData\Machines $dataPath\EgtCAM5\Machines Essetre-*
$altern = Get-ChildItem -Path V:\EgtData\Machines -Directory | Select-String -Pattern "Essetre"
foreach($item in $altern)
{
ROBOCOPY V:\EgtData\Machines\$item $dataPath\EgtCAM5\Machines\$item /MIR /FFT
}
#ROBOCOPY \\EGALTECHSERVER\EgtTech\EgtData\Machines $dataPath\EgtCAM5\Machines /E /Z /ZB /R:5 /W:5 /TBD /NP /V /XD \\EGALTECHSERVER\EgtTech\EgtData\Machines\Multiax*
ROBOCOPY /E V:\EgtData\ToolMakers $Folder4v2\ToolMakers
ROBOCOPY /E U:\EgtData\Beam\$choiceD $Folder4v2\Beam
ROBOCOPY /E U:\EgtData\Wall\$choiceD $Folder4v2\Wall
ROBOCOPY /E U:\EgtData\BeamWall\$choiceD $Folder4v2\BeamWall