MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.
'Run as administrator If WScript.Arguments.length = 0 Then Set Shell = CreateObject("Shell.Application") 'Pass a bogus argument with leading blank space, say [ uac] Shell.ShellExecute "wscript.exe", Chr(34) & WScript.ScriptFullName & Chr(34) & " uac", "", "runas", 1 Else 'Set runtime variables Today = Replace(Date(), "/", "-") BackupDest = "C:\Backup\inetpub\" & Today InetPubPath = "C:\inetpub\h51web\*" SQLBakPath = "C:\data_backups" DropBoxPath = "C:\Users\Administrator\Dropbox\From Server\data_backups" Set FSO = CreateObject("Scripting.FileSystemObject") Set SQLBakDir = FSO.GetFolder(SQLBakPath) Set Shell = WScript.CreateObject("WScript.Shell") 'If it's Friday do inetpub backup If (WeekDay(Now()) = 6) Then 'Create the folder for today's date, if it does not exist already If Not FSO.FolderExists(BackupDest) Then FSO.CreateFolder BackupDest End If 'Make a copy of today's inetpub directory Shell.Run("xcopy /C /Y /H /E /EXCLUDE:C:\ScheduledTasks\do_backups_exclusions.txt " & InetPubPath & " " & BackupDest) End If 'Move all the SQL backup files to the dropbox directory and 'delete any files whose names conflict (old) For Each File in SQLBakDir.Files DestFile = DropBoxPath & "\" & File.Name 'Delete the old version if the file already exists If FSO.FileExists(DestFile) Then FSO.DeleteFile DestFile End If FSO.MoveFile File.Path, DestFile Next 'Clean up any files/directories older than 21 days Shell.Run("forfiles /P C:\backup\inetpub /D -21 /C ""cmd /c DEL /F /Q @path""") 'Unset object variables and quit Set Shell = Nothing Set SQLBakDir = Nothing Set FSO = Nothing End If WScript.Quit()
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
|Server 2012 R2 says "Please wait" for a long time while booting into Windows||4||71|
|Let users to install software without administrator rights||7||107|
|DNS and Promoting Server 2012R2 to DC Issues||10||42|
|MCAT Verbal Reasoning||2||18|
Join the community of 500,000 technology professionals and ask your questions.