• Home
  • Scripts & Tools

Screensaver Operations 1.5 Released


Update (2017-06-27): We release a patched version (1.5.4) that implements a couple other minor updates and changes.

We've finally released the next version of Screensaver Operations.

Screensaver Operations is an application for Microsoft Windows systems that allows you to perform configurable actions after a computer has been left idle for a specified amount of time (e.g., log off, shut down, run a process).

Download Screensaver Operations 1.5

There are a lot of new bug fixes and a couple features in the latest release:

  • Bug/Security Fixes
    • Fixed issue where when enabling RunProcessEnabled, the default title and message texts were incorrect.
    • [Window XP & Windows Server 2003 Only] When using the RunProcessEnabled flag, older versions of Windows (XP, 2003) close the process when the screensaver ends. This is due to multiple factors. Windows XP, etc. closes child processes along with the screensaver. It also puts the screensaver in a separate Virtual Desktop and kills all processes in that desktop when the screensaver ends! We have implemented a workaround and running a process in older versions of Windows should work. This issues took many days to fix so we are glad that we got it to work!
    • Changed action button on process run to "Start Now" rather than "Start Process Now" (which was cut off as it only showed "Start Process").
    • Opens "Configure" properly from right-click context menu on SCR file.
    • Fixed some issues with double-quotes in process path or process argument.
    • Fixed issue where sometimes the Keyboard Filter "DisableSpecialKeys" would crash the program when a special key (e.g., the Windows key) was pressed.
  • New Features
    • Added: BackgroundOpacity registry value - Setting allows you to modify background opacity from the default of 75%. Some organizations might want to completely hide content. Note that this setting is not yet available from the Configuration GUI and can only be set via registry and ADMX. (Note: In Windows 8 and newer, Windows always shows an opaque background color as a security feature)
    • Added: A "Snow" Easter Egg. See the README for more information. :-)

Continue Reading

Detailed script to delete files and folders older than X days within a specific


Hi All,

First of all please accept my apologies if I posted this thread in this section of the forum: I believe that the old section for "VBScript" thread is no longer active.
 
I state in advance that the following solution is not enough for me:"http://www.grimadmin.com/article.php/vbs-delete-old-files-and-folders" so I have decided to make a more detailed script that does this job and generates a specific log file in .csv format so that I can filter everything as per my reference.
 
 
[WAY THE SCRIPT WORKS]
This script is essentially based on two input parameters:
  • targetFolderPath (I believe it's meaningful)
  • threshold (all the files/folders older than this value will be deleted)
 
Additionally this script is designed in a such a way that if a folder is older than 'threshold' but contains files and/or sub-folders younger than 'threshold', it will not be deleted!
 
 
[MY PROBLEM]
The script works fine (I believe) but during my tests (before putting it in production) I discovered that strangely if I reduce the value of the "threshold" parameter to a value lower than 11 for example, then the result is a .csv log file that does NOT contain all the entries (actually 90% of them are missing!!! ).
 
 
[TROUBLESHOOTING STEPS ALREADY FOLLOWED]
I checked more in depth the script and I noticed that the problem is in the recursive call:"manage(childFolderPath)".
 
 
[THE SCRIPT]
'***************************************************
'
' Script Name:    gct.vbs (VBScript) 
' Title:              Garbage Collection Tool
' Author:           Latin Cork
' Created On:    August 2013
'
' Purpose:    Given the specific path of a folder, 
'                this  script  deletes  all the files 
'                and subfolders older than a specific
'                number of days
' Note:       Execute  the   script   with  delete
'                permissions on files and subfolders
'                This version  shows  each file  and 
'                folder deleted along with other
'               details
'
'***************************************************
 
On Error Resume Next


'*************************************************** Main Input


targetFolderPath = "C:\Users\latincork\Desktop\Scripts\GCT\Bin"    ' Folder to which this script will be applied to
threshold = 12   ' All the files/folders older than this value will be deleted
 
'*************************************************** Set objects & error catching


Dim fso
Dim objFolder
Dim objFile
Dim objSubFolder


Const readMode     = 1
Const writeMode = 2
Const appendMode = 8
Const informationFlag = 64
Const errorFlag = 48
Const bytesToKB = 1024


outputResult = "Type,Full Path,Size (KB),Last Modified,Age (Days),Action" & vbCrLf
targetFile = "Log_Result_" & date() & ".csv"
targetFile = replace(targetFile, "/", "-")
title = "Garbage Collection Tool"
timeOut = 30 'Number of seconds after which the initial popup window disappears
initialMessage = "Target Folder: " & targetFolderPath & vbCrLf & vbCrLf & "Deleting files older than " & threshold & " days..."
finalMessage = "Task Completed!"


'*************************************************** Main sub-routine


Sub manage(currentFolderPath)
    Dim childFolderPath
    
    Set fso = CreateObject("Scripting.FileSystemObject")
    Set parentFolderPath = fso.GetFolder(currentFolderPath)
    
    'Delete each file
    For Each objFile In parentFolderPath.files
        ageOfCurrentFile = DateDiff("d", objFile.DateLastModified,Now)
        sizeOfCurrentFile = round(objFile.Size / bytesToKB)        
        If ageOfCurrentFile > threshold Then                        
            outputResult = outputResult & "File," & objFile.Path & "," & sizeOfCurrentFile & "," & objFile.DateLastModified & "," & ageOfCurrentFile & ",Deleted" & vbCrLf                        
            objFile.Delete True
        Else
            outputResult = outputResult & "File," & objFile.Path & "," & sizeOfCurrentFile & "," & objFile.DateLastModified & "," & ageOfCurrentFile & ",Skipped" & vbCrLf
        End If
    Next
    
    'Delete each sub-folder
    For Each objSubFolder In parentFolderPath.Subfolders
        childFolderLastModDate = objSubFolder.DateLastModified        
        childFolderPath = objSubFolder.Path
        ageOfCurrentFolder = DateDiff("d", childFolderLastModDate,Now)
        If isEmpty(childFolderPath) Then
            If ageOfCurrentFolder > threshold Then
                deleteCurrentFolder childFolderPath, childFolderLastModDate 
            Else
                outputResult = outputResult & "Folder," & childFolderPath & ",0," & childFolderLastModDate & "," & ageOfCurrentFolder & ",Skipped" & vbCrLf
            End If
        Else
            manage(childFolderPath)
            If isEmpty(childFolderPath) Then
                If ageOfCurrentFolder > threshold Then
                    deleteCurrentFolder childFolderPath, childFolderLastModDate 
                Else
                    outputResult = outputResult & "Folder," & childFolderPath & ",0," & childFolderLastModDate & "," & ageOfCurrentFolder & ",Skipped" & vbCrLf
                End If
            Else
                outputResult = outputResult & "Folder," & childFolderPath & ",0," & childFolderLastModDate & "," & ageOfCurrentFolder & ",Skipped" & vbCrLf
            End If
        End If
    Next    
End Sub


'*************************************************** Delete a specific folder and logs this action 


Sub deleteCurrentFolder(myFolderPath, lastModificationDate)
    Set folderToDelete = CreateObject("Scripting.FileSystemObject")
    ageOfFolder = DateDiff("d", lastModificationDate,Now)
    outputResult = outputResult & "Folder," & myFolderPath & ",0," & lastModificationDate & "," & ageOfFolder & ",Deleted" & vbCrLf
    folderToDelete.DeleteFolder(myFolderPath)
End Sub


'*************************************************** Create log file 


Sub createLogFile(filePath)
    set objFSO    = CreateObject("Scripting.FileSystemObject")
    set myFile = objFSO.OpenTextFile(targetFile, writeMode, True, -2)
    myFile.WriteLine outputResult
    myFile.close
End Sub
 
'*************************************************** Check if current folder is empty


Function isEmpty(myFolder)
    Dim objFSO, objFolder
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    If objFSO.FolderExists(myFolder) Then
        Set objFolder = objFSO.GetFolder(myFolder)    
        If objFolder.Files.Count = 0 And objFolder.SubFolders.Count = 0 Then
            isEmpty = True
        Else
            isEmpty = False
        End If
    End If 
End Function


'*************************************************** Show popup message for a limited amount of time only


Sub showMessage(when)
    Select Case when
        Case "begin"
            Set objShell = CreateObject("Wscript.Shell")
            intReturn = objShell.Popup(initialMessage, timeOut, title, informationFlag)
        Case "end"
            MsgBox finalMessage, informationFlag, title        
    End Select    
End Sub


'*************************************************** Start Script


showMessage("begin")
manage(targetFolderPath)
createLogFile(targetFile)
showMessage("end")

 

I would be very very grateful if somebody is able to help me or to point me to the right direction.

Thanks in advance.

 

Regards,

   Latin cork

Screensaver Operations News - March 2013


Thanks for the suggestions everyone. What’s in the pipeline? This:

 

 

UPDATE (2013-04-02): 1.4 was completed last week; we just are working getting the proper installer file(s) working. Expect it out this week.

UPDATE (2013-04-05): 1.4 has been released. ADM files are in the works still. Note that following Microsoft's installations standards has forced us to create separate 32-bit and 64-bit MSI installers. Both versions should upgrade the previous 1.3 install without issues (assuming you previously used the MSI to install).

  • Official release of SSO 1.4
    • I’ve been trying to do coding here and there in the little free time I have right now. I am planning on releasing 1.4 sometime this month. Yay!
    • A number of requests have already been implemented in the beta (http://www.grimadmin.com/forum/viewtopic.php?showtopic=43) and the as-of-yet unreleased code has a few more already completed. I have only a couple more things to pop in, including a variable naming conflict that a forum poster found in the beta.
    • Some requests are a little trickier to implement due to staying with the older .NET 2.0 (e.g., capturing mouse clicks outside the program window), but this is worth it IMO to prevent those still running older versions of Windows like XP from having to install.NET framework runtimes.
  • ADMX/ADML files for Group Policy: While I think using registry collections in GPP is simple enough, especially with the registry locations now being the same in version 1.4 for both 32-bit & 64-bit Windows, I am going to create some Group Policy Settings files for SSO due to all the requests. If anyone knows of a better free ADMX editor than the ADMX Migrator tool (http://www.microsoft.com/en-us/download/details.aspx?id=15058) let me know!
  • Some have wondered about adding to the project. If there are any experienced coders out there who would like to work on the code, I’d be happy to work with them (contact me here). I’m also willing to share the source code if someone needs to review it before deploying; you can change anything for use within your organization, but I ask that you not publicly post any source files for the time being. If I ever stop working on the project, I’ll upload the source code under an open & royalty free license.
  • Hate to plug this, but the advertising on this site is minimal and [hopefully] unobtrusive; it honestly doesn’t come close to covering even the hosting costs. I know most admins out there have trained themselves to completely ignore ads, but please take a quick glance over at them once in a while to see if you find them interesting. Please don’t go spam clicking on them though! The SSO page also has a donate button on the bottom of the page if you would like to donate anything.
  • Finally, a reminder that I may not see comments posted to stories or the download pages. Please submit any suggestions, issues, questions, etc. to us using http://www.grimadmin.com/profiles.php?uid=2 to e-mail me or by posting on the forums.

Continue Reading

Screensaver Operations Beta 1.4-b Now Available


Dear admins! I know we've been missing with updates for a while, but we hope to get things rolling again soon! To that end, I wanted to update everyone on the latest beta version of Screensaver Operations. This beta release is primarily marked by the ability to natively run on both 32-bit and 64-bit Windows, as well as some feature requests.

 

Download Screensaver Operations Beta 1.4-b now in our forums!

 

Screensaver Operations is an application for Microsoft Windows systems that allows you to perform configurable actions after a computer has been left idle for a specified amount of time (e.g., log off, shut down).

Continue Reading

Repair Messed Up EXE File Association


Some viruses now are messing with your file associations making it hard to open programs, such as your Web browser so that you can download and install an anti-mailware program, or even open the cleaner application itself. It's usually simple to remove the changes made when in a registry editor, but since Regedit.exe and other editors are executable files, you can't easily open them either!

Below is a registry fix that I have found useful to have on hand to easily reset the .EXE file association back to it's normal state so that you are no longer prevented from running programs.

 

Repair EXE Registration.reg

Windows Registry Editor Version 5.00

[-HKEY_CURRENT_USER\Software\Classes\.exe]
[-HKEY_CURRENT_USER\Software\Classes\secfile]
[-HKEY_CLASSES_ROOT\secfile]
[-HKEY_CLASSES_ROOT\.exe\shell\open\command]

[HKEY_CLASSES_ROOT\exefile\shell\open\command]
@="\"%1\" %*"
[HKEY_CLASSES_ROOT\.exe]
@="exefile"
"Content Type"="application/x-msdownload"

 

Importing this registry data file will remove any custom edits that any malware makes to your .EXE file associations in the HKCU area and then sets the file association open command back to normal. From there you should be able to open your malware cleaning tools.

We recommend that you copy the registry data file to a local disk on your computer prior to running due to the fact that newer versions of Windows will often by default not allow you to import a .REG file if you run it from a network share.

Continue Reading

Screensaver Operations MSI Version


Screensaver Operations, an application for Microsoft Windows systems that allows you to perform configurable actions after a computer has been left idle for a specified amount of time (e.g., log off, shut down), is now available in Windows Installer format (MSI) so you can easily install it or deploy it through Group Policy or other means.

Click Here for More Information and Download

Continue Reading

New Screensaver Operations for Windows Utility


We've just relased the initial version of a free tool, called Screensaver Operations, for Microsoft Windows systems that allows you to perform configurable actions after a computer has been left idle for a specified amount of time.

 

Features include:

  • Log off user, shut down or restart computer, or run any process when left idle
  • Optional warning message allowing users to cancel out
  • Can be configured & enforced via registry & Group Policy Preferences
  • Highly customizable with many easily configurable options such as delay time and custom messages
  • Colors can be adjusted to match your organization policies
  • Great replacement for the outdated Windows Exit Screen Saver Tool (Winexit.scr)
  • Windows Vista & Windows 7 compatible
  • Supports both 32-bit & 64-bit Windows operating systems

Click Here for Details and Download

Continue Reading

File Searcher by Owner Version 1.1.0.0 Released


An update to our File Searcher by Owner utility has been released, bringing it up to version 1.1.0.0. This tool can be used to search for local or network shared files and folders by a local or domain user or group. In addition to some minor adjustments and textual changes, you can now browse or search for users and groups on your computer or within a domain.

 

Click Here for the ChangeLog and Download

Continue Reading

VBScript: Shut Down Computer If Not Logged On


Here are a couple VBScripts that you can use to shut down computers if no one is logged on at the time the script is run. This is useful if you want to make sure computers are shut down at the end of the day, but don't want to shut them down if someone is logged in and working. The difference between the two scripts is that one would be run on the local machine(s) that you want to shut down, while the second script can be run from one computer and will attempt to shut down all computers in a specified Organizational Unit (OU). You can use the Task Scheduler to run either of these scripts at a specific time of the day or week.

Obviously, you could also cut out the parts that test to see if someone is logged on if you don't want or need that check

Both of these scripts use the Windows Management Instrumentation (WMI) service and should work on any version of Microsoft Windows from Windows 2000 up and possibly Windows NT, Windows 95, & Windows 98 with the WMI CORE 1.5 distributable.

 

Continue on for the VBS code...

Continue Reading