January 9, 2009 3:59 PM
Posted by: Dave Raffo
I recently needed to whip up a quick script to delete all files in a directory that were older than X number of days. Hopefully it is something that you can use, too. Copy the code and paste it into a text file named something like “cleanup-folder.vbs” and set the variables for strDir (the absolute path to the directory) and strDays (files older than this number of days will be deleted).
' ################################################################
' # cleanup-folder.vbs
' #
' # Removes all files older than 1 week
' # Authored by Spencer Kuziw (s.kuziw-at-epic.ca)
' # Based on code by YellowShoe
' # Version 1.0 - Sept 23 2008
' ################################################################
Dim fso, f, f1, fc, strComments, strScanDir
' user variables
' ----------------------------------------------------------------
strDir = "FULL\PATH\TO\FOLDER\TO\BE\CLEANED"
strDays = 7
' DO NOT EDIT BELOW THIS LINE
' (unless you know what you are doing)
'------------------------------------------------------------------
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFolder(strDir)
Set fc = f.Files
For Each f1 in fc
If DateDiff("d", f1.DateCreated, Date) > strDays Then
'strComments = strComments & f1.name & " " & f1.DateCreated & vbCrLf
fso.DeleteFile(f1)
End If
Next
'wscript.echo strComments
WScript.Quit
' eof
January 8, 2009 7:01 PM
Posted by: Dave Raffo
Recently, I was tasked with an Office 2007 rollout for a client. The client’s workstations currently had a mix of Office 2003 and Office XP installed and a mix of Vista, XP and Server 2008 operating systems. Also, some users wanted to keep their old versions of Office, so I was going to have to be selective in the deployment. I had no other software deployment tools at my disposal, so I was stuck using Group Policy to push out this upgrade. In the past, I have not had the best success upgrading to Office 2007 using the Software Installation feature of Group Policy and had been resigned to using a GP logon script to perform the installation instead. The installation script I had written was going to need a lot of modification in order to work with the different variables I outlined above. Then I remembered reading about a new application virtualization product from VMware called ThinApp.
Application virtualization is software that improves the portability, manageability and compatibility of applications by abstracting them from the underlying operating system. VMware ThinApp provides a bunch of advantages over traditional application installations, but in the scope of this particular project, the advantages were Application isolation and Active Directory integration.
Application isolation enables the rollout of the Office 2007 package to all workstations, but still allowed users who prefer their older Office revisions to run their preferred version. Multiple versions of an application can co-exist when virtualized with ThinApp.
ThinApp does not use a management server of its own. Instead, it uses standard Windows functionality. Upgrades to packages are via either http or cifs shares and installations are performed using Group Policy’s Software Installation
I am currently in the testing phase of the deployment and am working off the following documents:
I’ll be writing more about my finding on this project soon.