This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$A=New-ScheduledTaskAction -Execute 'C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe' -Argument '-File D:\ScriptsPowerShellProgramados\BackUpSXG5DB.ps1' | |
$T=New-ScheduledTaskTrigger -Daily -At 1:00am | |
$U=New-ScheduledTaskPrincipal -UserId "HOSPITAL\Administrador" -LogonType ServiceAccount -RunLevel Highest | |
$S=New-Scheduledtasksettingsset | |
$D=New-ScheduledTask -Action $A -Principal $U -Trigger $T -Settings $S -Description "Ejecutar Copia de Seguridad de SXG5DB" | |
Register-ScheduledTask BackUpSXG5DB -InputObject $D |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Ruta al ejecutable de 7-Zip | |
$sevenZipPath = "C:\Program Files\7-Zip\7z.exe" | |
# Obtener la fecha y hora actual en el formato deseado | |
$fechaHoraActual = Get-Date -Format "yyyyMMdd_HHmmss" | |
# Nombre del archivo comprimido | |
$nombreArchivo = "$fechaHoraActual.7z" | |
# Rutas de las carpetas a comprimir |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$A=New-ScheduledTaskAction -Execute 'C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe' -Argument '-File D:\ScriptsPowerShellProgramados\BackUpDbToHDD.ps1' | |
$T=New-ScheduledTaskTrigger -Daily -At 11:00pm | |
$U=New-ScheduledTaskPrincipal -UserId "HOSPITAL\Administrador" -LogonType ServiceAccount -RunLevel Highest | |
$S=New-Scheduledtasksettingsset | |
$D=New-ScheduledTask -Action $A -Principal $U -Trigger $T -Settings $S -Description "Copiar BackUp de la base de datos de Xenco Disco Duro ADATA" | |
Register-ScheduledTask BackUpDbToHDD -InputObject $D |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copiar BackUp de Xenco a Disco Duro ADATA Ubicado en Unidad E:\BackUps\BETANIA | |
$driveLetter = "E:" | |
# Establecer la contraseña de BitLocker en una variable | |
$password = <Passoword BitLocker> | |
#Obtener Ruta de la ultima copia de seguridad de la Base de Datos Betania | |
$PathToBackUpFile = Get-ChildItem -Path D:\Backup_SQL -Filter "*.7z" | Sort-Object LastAccessTime -Descending | Select-Object Fullname -First 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$A=New-ScheduledTaskAction -Execute 'C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe' -Argument '-File D:\ScriptsPowerShellProgramados\BackUpDbXenco.ps1' | |
$T=New-ScheduledTaskTrigger -Daily -At 08:00pm | |
$U=New-ScheduledTaskPrincipal -UserId "HOSPITAL\Administrador" -LogonType ServiceAccount -RunLevel Highest | |
$S=New-Scheduledtasksettingsset | |
$D=New-ScheduledTask -Action $A -Principal $U -Trigger $T -Settings $S -Description "Copia de Seguridad Base de Datos BETANIA 08:00 PM" | |
Register-ScheduledTask BackUpXenco08PM -InputObject $D |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$A=New-ScheduledTaskAction -Execute 'C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe' -Argument '-File D:\ScriptsPowerShellProgramados\BackUpDbXenco.ps1' | |
$T=New-ScheduledTaskTrigger -Daily -At 12:00pm | |
$U=New-ScheduledTaskPrincipal -UserId "HOSPITAL\Administrador" -LogonType ServiceAccount -RunLevel Highest | |
$S=New-Scheduledtasksettingsset | |
$D=New-ScheduledTask -Action $A -Principal $U -Trigger $T -Settings $S -Description "Copia de Seguridad Base de Datos BETANIA 12:00 PM" | |
Register-ScheduledTask BackUpXenco12PM -InputObject $D |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$A=New-ScheduledTaskAction -Execute 'C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe' -Argument '-File D:\ScriptsPowerShellProgramados\BackUpDbXenco.ps1' | |
$T=New-ScheduledTaskTrigger -Daily -At 6:00am | |
$U=New-ScheduledTaskPrincipal -UserId "HOSPITAL\Administrador" -LogonType ServiceAccount -RunLevel Highest | |
$S=New-Scheduledtasksettingsset | |
$D=New-ScheduledTask -Action $A -Principal $U -Trigger $T -Settings $S -Description "Copia de Seguridad Base de Datos BETANIA 06:00 AM" | |
Register-ScheduledTask BackUpXenco06AM -InputObject $D |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Ruta completa al ejecutable sqlcmd | |
$sqlcmdPath = "D:\ScriptsPowerShellProgramados\sqlcmd.exe" | |
# Ruta al ejecutable de 7-Zip | |
$sevenZipPath = "C:\Program Files\7-Zip\7z.exe" | |
# Obtener la fecha actual | |
$fecha = Get-Date -Format "yyyyMMdd_HHmmss" | |
# Limpiar Carpeta |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Contar Lineas en Archivos Individuales | |
(Get-Content -Path "D:\SSIS\ImportRIPS\Archive\AC.txt").Count | |
# Contar Lineas en Multiples Archivos | |
(Get-ChildItem -Path "D:\SSIS\ImportRIPS\AC\" -Filter *.txt -Recurse | Get-Content | Measure-Object -Line).Lines |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Permitir Ejecución de Scripts en PowerShell | |
Set-ExecutionPolicy RemoteSigned | |
# Unir Todos los Archivos RIPS en un solo archivo de cada tipo | |
Get-Content -Path "D:\SSIS\ImportRIPS\AC\*.txt" | Set-Content -Path "D:\SSIS\ImportRIPS\Archive\AC.txt" | |
Get-Content -Path "D:\SSIS\ImportRIPS\AF\*.txt" | Set-Content -Path "D:\SSIS\ImportRIPS\Archive\AF.txt" | |
Get-Content -Path "D:\SSIS\ImportRIPS\AH\*.txt" | Set-Content -Path "D:\SSIS\ImportRIPS\Archive\AH.txt" | |
Get-Content -Path "D:\SSIS\ImportRIPS\AM\*.txt" | Set-Content -Path "D:\SSIS\ImportRIPS\Archive\AM.txt" | |
Get-Content -Path "D:\SSIS\ImportRIPS\AN\*.txt" | Set-Content -Path "D:\SSIS\ImportRIPS\Archive\AN.txt" | |
Get-Content -Path "D:\SSIS\ImportRIPS\AP\*.txt" | Set-Content -Path "D:\SSIS\ImportRIPS\Archive\AP.txt" |
NewerOlder