PowerShell script to automate BGInfo update every hour
# PowerShell script to automate BGInfo update every hour # Variables $sourcePath = "\\win1\c$\Windows\SYSVOL\sysvol\apex.local\scripts" # Example path "\\YourServer\SharedFolder" $destinationPath = "C:\ProgramData\Packages\bginfo" # Example path "C:\LocalFolder" $bgInfoExecutable = "Bginfo64.exe" $configFile = "config.bgi" # Function to copy files if they are updated function Update-Files { $sourceFiles = Get-ChildItem -Path $sourcePath foreach ($file in $sourceFiles) { $localFile = Join-Path -Path $destinationPath -ChildPath $file.Name if (Test-Path $localFile) { $localFileInfo = Get-Item $localFile if ($localFileInfo.LastWriteTime -lt $file.LastWriteTime) { Copy-Item -Path $file.FullName -Destination $localFile -Force } } else { Copy-Item -Path $file.FullName -Destination $localFile } } } # Function to schedule BGIn