May 27, 2009 - General Web Development Comments Off on Web site database nightly database download
Web site database nightly database download
The PokerPincher MS Access database is downloaded nightly from the GoDaddy web space. This is done with a PowerShell script which is scheduled with the Windows Task Scheduler, which runs a batch file.
The batch file used looks like this:
RunFTP_PS.bat
The PowerShell script used looks like this:
ftp.ps1 $text = @" open sitename.com USERNAME PASSWORD CD sourcedirectory get databasename.mdb C:\targetdirectory\databasename.mdb quit "@ $text | set-content c:\ftpscript.txt & $env:systemroot\system32\ftp.exe -s:c:\ftpscript.txt remove-item c:\ftpscript.txt
Note: There was an issue with the downloaded file being locked for use by the HomeUsers security group. This was because it was inheriting the permissions of the Temp folder used for the download, and then not inheriting the correct permissions when moved to the target folder. To fix this, I added the HomeUsers group with Modify permissions on the Temp folder, located at C:\Users\username\AppData\Local\Temp.