Files
claudetools/projects/dataforth-dos/deployment-scripts/deploy-bat-files-to-ad2.ps1

29 lines
1.1 KiB
PowerShell

# Deploy DEPLOY.BAT and UPDATE.BAT to AD2
# Files will be synced to NAS by AD2's Sync-FromNAS.ps1 script
$Username = "INTRANET\sysadmin"
$Password = ConvertTo-SecureString "Paper123!@#" -AsPlainText -Force
$Cred = New-Object System.Management.Automation.PSCredential($Username, $Password)
Write-Host "[INFO] Connecting to AD2..."
New-PSDrive -Name TEMP_AD2 -PSProvider FileSystem -Root "\\192.168.0.6\C$" -Credential $Cred -ErrorAction Stop | Out-Null
Write-Host "[INFO] Copying DEPLOY.BAT..."
Copy-Item DEPLOY.BAT TEMP_AD2:\Shares\test\ -Force
Write-Host "[INFO] Copying UPDATE.BAT..."
Copy-Item UPDATE.BAT TEMP_AD2:\Shares\test\ -Force
Write-Host "[INFO] Verifying line endings..."
$localDeploy = Get-Content DEPLOY.BAT -Raw
$adDeploy = Get-Content TEMP_AD2:\Shares\test\DEPLOY.BAT -Raw
if ($localDeploy -eq $adDeploy) {
Write-Host "[OK] Files copied successfully with CRLF line endings preserved"
} else {
Write-Host "[WARNING] File content may differ"
}
Remove-PSDrive TEMP_AD2
Write-Host "[SUCCESS] Deployment complete. Files will sync to NAS within 15 minutes."