Accorpamento Progetti Powershell Script

This commit is contained in:
marco.locatelli@steamware.net
2024-02-21 11:23:47 +01:00
parent 236bcf195c
commit 7f87236961
33 changed files with 3392 additions and 0 deletions
+246
View File
@@ -0,0 +1,246 @@
# 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"
$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!'
}
$Folder5 = 'c:\EgtTestData\EgtBEAMWALL\Fonts'
if (Test-Path -Path $Folder5) {
"Font esiste!"
rm -Recurse $Folder5\*.*
} else {
new-item c:\EgtTestData\EgtBEAMWALL\Fonts -itemtype directory
}
$Folder6 = 'c:\EgtTestData\EgtBEAMWALL\Temp'
if (Test-Path -Path $Folder6) {
"Temp esiste!"
rm -Recurse $Folder6\*.*
} else {
new-item c:\EgtTestData\EgtBEAMWALL\Temp -itemtype directory
}
$Folder7 = 'c:\EgtTestData\EgtBEAMWALL\Config'
if (Test-Path -Path $Folder7) {
"Config esiste!"
rm -Recurse $Folder7\*.*
} else {
new-item c:\EgtTestData\Fonts -itemtype directory
}
# ora chiedo quale branch scegliere
Write-Output ""
$valOk = $false
$altern = Get-ChildItem -Path $zPath -Directory
$numFolder = $altern.Count
do{
$idx = 1
Write-Output "-----------------------------"
foreach($item in $altern)
{
Write-Output("$idx - $item")
$idx++
}
Write-Output "-----------------------------"
Write-Output ""
Write-Output ""
$branch = @(Get-ChildItem $zPath -Directory | Out-GridView -Title 'Scegli il branch' -PassThru)
$valOk = ($numSel -le $numFolder)
} while(!$valOk)
#$valOk = $false
#do{
# $arch64 = Read-Host "Vuoi Architettura 64 bit (s/n)"
# $valOk = ($arch64.ToUpper() -eq "N" -or $arch64.ToUpper() -eq "S")
#} while(!$valOk)
#Write-Output "64 bit: $arch64"
# ora chiedo quale variante vuole
Write-Output ""
$valOk = $false
$altern = Get-ChildItem -Path $zPath -Directory
$numFolder = $altern.Count
#do{
# $idx = 1
# Write-Output "-----------------------------"
# foreach($item in $altern)
# {
# Write-Output("$idx - $item")
# $idx++
# }
# Write-Output "-----------------------------"
# Write-Output ""
# Write-Output ""
# $choice = @(Get-ChildItem $zPath\$branch | Out-GridView -Title 'Scegli architettura x64 o x32' -PassThru)
# Write-Output "$choice"
# $valOk = ($numSel -le $numFolder)
#
#} while(!$valOk)
function Show-MenuA
{
param (
[string]$Title = 'Seleziona Architettura da testare'
)
Clear-Host
Write-Host "================ $Title ================"
Write-Host "1: Premi '1' per x86"
Write-Host "2: Premi '2' per x64"
Write-Host "q: Premi 'q' per uscire dal programma."
}
Show-MenuA Title 'Seleziona Architettura da testare'
$selection = Read-Host "Seleziona"
switch ($selection)
{
'1' {
$choice = 'x86'
'Hai scelto 32'
} '2' {
$choice = 'x64'
'Hai scelto 64'
} 'q' {
return
}
}
#function Show-Menu
#{
# param (
# [string]$Title = 'Seleziona Architettura Lualibs'
# )
# 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 Lualibs'
#
#$selection = Read-Host "Seleziona"
# switch ($selection)
# {
# '1' {
# $choiceL = '32'
# 'Hai scelto 32'
# } '2' {
# $choiceL = '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($choice -eq 'x86'){
$choiceL = '32'
$choiceC = 'Dll32'
}else {
$choiceL = '64'
$choiceC = 'Dll64'
}
#$choiceL = @(Get-ChildItem V:\EgtProg\LuaLibs\ | Out-GridView -Title 'Scegli architettura Lualibs' -PassThru)
#$choiceC = @(Get-ChildItem V:\EgtProg\ | Out-GridView -Title 'Scegli architettura Librerie C' -PassThru)
ROBOCOPY /E U:\EgtProg\EgtBEAMWALL\$branch\$choice $progPath
ROBOCOPY /E U:\EgtProg\EgtBEAMWALL_Config\Config $dataPath\EgtBEAMWALL\Config
ROBOCOPY /E V:\EgtProg\LuaLibs\$choiceL $dataPath\Lualibs
ROBOCOPY /E U:\EgtProg\EgtBEAMWALL_Config $progPath DataRoot.ini
ROBOCOPY /E V:\EgtProg\$choiceC $progPath
#ROBOCOPY /E Z:\EgtData\Messages $dataPath\EgtBEAMWALL\Config
ROBOCOPY /E V:\EgtProg\Fonts $Folder5
+177
View File
@@ -0,0 +1,177 @@
# 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