Alan's Blog

"Yeah. I wrote a script that will do that."

Problem reading DateLastModified of file in root of C: by non-admin User on Win7

Posted on July 8th, 2011

Create a file, c:\test.txt using administrative rights on Windows 7. Add any data and save
Change modification stamp by editing it and saving

Run this vbscript:
set fso = CreateObject(“Scripting.FileSystemObject”)
logfile = “c:\test.txt”
Set f = fso.GetFile(Logfile)
dModifiedTime = f.DateLastModified
wscript.echo dModifiedTime

I found that the above works for admin user, but returns file creation time or an error for non admin user.  This is odd because user’s have read permissions to files in this folder.

Filed under VbScript | No Comments »

USB Monitor for Removable Drives

Posted on April 7th, 2010

Having users plug USB drives into their systems can be a portal for malware into your network and data exiting from your network.  There are sophisticated programs that allow you to block and monitor endpoint security, such as Lumension’s Sanctuary.  If you don’t have that in your budget, you can still monitor and detect insertion of USB drives onto your computers.  USBMonitor.vbs is a highly configurable script that can send you email alerts when a user inserts a drive.  The alert will have the user’s name, the device they inserted and the time it happened.  The script can also generate an annoying beep that persists as long as the drive is inserted.  Users get a pop-up window with a message telling them to remove the drive.  You can permit certain devices to be used by all users, by all users at a certain workstation, or by a single user.  This way you can say that Bob can use a camera, or all users may use an approved IronKey.

Email is sent to the administrator via SMTP.  Take time to read the comments, which should guide you to the required edits for this to work in your environment.   Version 4 (4/7/10) adds options for exiting the program for servers and administrators, and reporting if endpoint security software is working.  It also can dismount the drive using the freeware USB Disk Ejector program, which may be downloaded here:  If you need assistance implementing this in your environment, send me an email.

Tags: USB+Monitor

Tags: , , ,
Filed under Alan's Favorites, My Best, Security, VbScript, Windows Administration | No Comments »

Please Note

All the scripts are saved as .txt files. Newer files have a "View Script" button which will let you save or open a script in notepad. For earlier posts, the easiest way to download with IE is to right click on the link and use "Save Target As". Rename file from Name_ext.txt to Name.ext.

To see a full post after searching, please click on the title.

PowerShell Scripts were written with Version 3 or 4.

https connections are supported.

All new users accounts must be approved, as are comments. Please be patient. It is pretty easy to figure out my email address from the scripts, and you are welcome to contact me that way.

Site Search



SQL Site

Bad Behavior has blocked 262 access attempts in the last 7 days.