
Have you written a script that accomplishes some administrative task? Please share it! Just navigate to the appropriate category and click the "Contribute to this category" link!
You are here: Top > Files and Folders
Contribute to this category
Sub-Categories
(no categories are available)
Scripts
Add DateMove a File (JS) Contributed by Jim Vierra
Simple subroutine to rename a file adding the date to the name. If destination path is different from original the file will be moved to the new location. Calling method: ArchiveLogFile( strSourceFilePathName, strDestinationPath); Function does error trapping.Add DateMove a File Contributed by Jim Vierra
Simple subroutine to rename a file adding the date to the name. If destination path is different from original the file will be moved to the new location. Calling method: ArchiveLogFile strSourceFilePathName, strDestinationPath File name becomes: c:\folder\file.txt -> c:\detfolder\file_YYYY-MM-DD.txt Changing the "Format statement will change date format.Automatic Defragmentor Contributed by Electronic_Chris
This script is an auto-defragmenter for Windows XP. It should probe your disk volumes and automatically defrag them. It has not been tested with mapped drives, with floppy disk in use, with cd-roms in use, and other medias such as thumb drives. However since it does deal with FAT16 & FAT32, those Medias might cause problems. I also included a loop to run the defrag process as many times as you want, just change the variable in the third line “set /a run_times=1” to how many times you actually want to defrag your volumes (say 50 to have a REALLY REALY defragmented drive).BrowseForFile.vbs Contributed by Christian Sawyer
This dialog box is actually used in the User Accounts control panel (Nusrmgr.cpl) found in Windows XP (and it only works under Windows XP). It’s a real-live File Open dialog box, with just one real limitation: it’s best for selecting a single file at a time.Checking file versions Contributed by Marshall
A short while back a need arrived in my workplace to check the KernelVersions of our Windows systems. While I'm sure it was patchrelated I can't remember which patch, exactly off hand. Thatbeing beside the point, I wrote this script then to check the KernelVersions of multiple systems as specified in the SERVERS.INI file. This script will output the objFSO.GetFileVersion value,along with the path specified to a .CSV formated file. The scriptitself is relativley portable and should you choose to change the strTARGETFile value you can have itpull the objFSO.GetFileVersion valuefrom any remote file you wish. It was a given that ntoskrnl.exewould exist, so I didn't add any error handling -- shouldyou choose to change the file you're getting the version of you maywish to include error handling. You'll have to create the SERVERS.INI file which is just a flat textfile which should contain the hostname or IP address ofeach system you wish to run the script against. (1 hostname or IPaddress per line)Checking for multiple folders Contributed by JR Williams
Script will check and verify the existance of folders. Our use was to find PC's that were not on our standard setup. Standardization...CompBackup Contributed by Kyle Dooley
1. The backed up files are compressed. you must expand them with the windows expand utility. 2. This script requires compress.exe from windows 2000. there is a bug in the xp version. This script is designed to run with cscript. do not double click unless you want to take out all of the echo commands. The first run of this script on a directory will use the most computer resources' and take the longest time to complete. after that it only copies new files. this is a feature of the compress utility leveraged by the script. The script makes use of that utility to accomplish this. To run continuously you might set the speed value to a very high number. To run at night on a schedule you might set it to a very low value thus increasing the speed and recourses used. To uncompress your files use expand.exe from any windows os. type expand /? at the command prompt. This script requires compress.exe from windows 2000. there is a bug in compress.exe in windows xp/ 2003 . That bug does not allow you to pass a full path to the utility. you can copy the compress.exe from windows 2000 to any xp/2003 Machine and address it directly at it's location. otherwise this script will not work on xp/2003Compress Folders with VBScript Contributed by donj
Someone asked if it was possible to write a VBScript that turned on NTFS compression for a folder. Yup. You can even combine this with my "run against multiple computers" shell script to do this to a number of machines, or put this into a logon script to comrpess a particular folder on all computers. Notice that you do have to specify the folder. In this case it's just C:\Folder, but whatever you specify remember to include two backslashes for each instance, not one; that's just a quirk of how WMI queries have to be written This scriptlet was adapted from a sample on the Microsoft TechNet Script Center.Compress Shared Folders Contributed by Don Jones
Save space on your file servers by automatically setting the compression attribute for all folders under each share.Copy exact folder structure from any source to any destination Contributed by Christian Sawyer
Everything from the source folder and all subfolders will be copied in folder choosen by the user. All files in each folder/subfolders will be copied also, except if you want exclude some files group as exe, com, hta or any other extension. In that Case all files will be copied except what is in strExcludedExt.Delete all the folders and files in a share Contributed by Pranoy Rao
This script deletes files and folders present in a network share give the UNC path for the same.Delete Folder Contributed by James Vierra
Function to delete a folder and it's contents including all subfoldersDelete Temp, Bak, Log, etc... from folder of choosing, Revision B Contributed by Joel De La Torre
Cleans out files older than 4 days with the extension of BAK,TMP,ERR,DMP,DWL,XLG,LOG,TSF. Mostly CAD extension files. Prompts for a folder to purge and cleans out those files and any files with subfolders. Inspired by S. Hussain Akbar Temp file deletion script.Delete Temp, Bak, Log, etc... from folder of choosing Contributed by Joel De La Torre
Cleans out files older than 4 days with the extension of BAK,TMP,ERR,DMP,DWL,XLG,LOG,TSF. Mostly CAD extension files. Prompts for a folder to purge and cleans out those files and any files with subfolders. Inspired by S. Hussain Akbar Temp file deletion script.DelFileByExtAndAge.vbs Contributed by Ryan
The script originally deleted files based on age in days. Christian Sawyer added functionality to also delete files based on file extension. I now use the script to delete .log files older than 60 days on our web servers.Display Security for a file or folder using WMI Contributed by Jim Vierra
THe file contains a function that takes a machine name and file or folder name and echos the values of the file security settings. The settings are decoded to standard text descriptions. Use this as a starting point ffor getting file security. The function also retrieves the file owner.Empty Recycle Bin via VBScript Contributed by Courtney
This script will delete all files/folders in the "Recycle Bin" for the current logged on user via VBScript. No prompts or anything, so make sure to tweak the code if you want something of that nature. If you want to log this information use the WriteLine sub to send a line of text to the g_objsLogFile object; see line 46 or line 78 as an example. Use this script at your own risk!EmptyFolderTracker Contributed by Christian Sawyer
The Empty Folder Tracker uses VBScript and the Windows Script Host to scan an entire hard disk or any path including network drives and compile a report of all the empty folders found. It will then allow you to delete each empty folder(s) based on report displayed using Notepad. Empty Folder Tracker is compatible with all versions of Windows. There is two sub in this script I suppressed because I can't attached gif files with script in submit script. Those two subs display a progress bar in IE format when there is a lot of folders to search for. If you want the complete script, send me an email as indicated in main header.Enumerate directory Routine Contributed by jhicks91
This is a quick subroutine you can use in your scripts to enumerate files in a given directory. There is also code if you just want to get the number of files in a directory without counting every single file. This does not recurse through directories but you could incoporate this sub routine into code that does.Extended Map Drive Script Contributed by Witlr
Many Scripts to simply map a drive are out there for download. What if you want to map a drive using a different user account though. Your logged on a user but need to access an Admin Share through your Admin Account. This script prompts for User Account and Password before mapping the drive.Find and List Old Files Contributed by Bobk
This script list files older than a certain date. The script reads a parameters (text) file for a list of folders, extensions, and age requirements, and outputs the results to an XML file for display in IE. Be aware that this posting includes two files. The second file is appended at the bottom, but should be parsed onto its own before running. Also, because posting html was an issue, I replaced all < symbols with *{. Before running this script, do a global replace of all *{ occurances with <. 2 files - DOCSCAN.VBS and OPTIONS.INIFind files with WMI Contributed by jhicks91
This script uses WMI to search a specified drive for a specified file type, such as DOC. A CSV file is created that captures the file name, size, created date, last modified date and last accessed date. You could modify the WQL query for additional information.FolderSizeTracker.vbs Contributed by Christian Sawyer
The Folder Size Tracker Tool offers a more efficient alternative to the manual approach. To find out which folders on a hard disk are consuming the most space, you just point Folder Size Tracker to the path you want to investigate and let it go to work. The results are then compiled in an Excel worksheet and displayed in a rotating 3-D pie chart, making it easy to spot which folders are hogging the most disk space.FolderSizeTracker Contributed by Christian Sawyer
The Folder Size Tracker Tool offers a more efficient alternative to the manual approach. To find out which folders on a hard disk are consuming the most space, you just point Folder Size Tracker to the path you want to investigate and let it go to work. The results are then compiled in an Excel worksheet and displayed in a rotating 3-D pie chart, making it easy to spot which folders are hogging the most disk space.Generic Log File Analyzer Contributed by Chris Chao
The idea of this script came from one of the members in this forum who was asking help on how to grab certain information from a log file. I then decided to go a step further and make it accept command line parameters to allow a user to search for any file for information.Get detailed file information with WMI Contributed by jhicks91
Here's a script that will use WMI to pull up a file's basic information, owner, and NTFS permissions.HTA Rename Files Contributed by Tony Colgrove
This quick little HTA will rename files in a starting folder based upon the Find/Replace features. Find (Search) can be case sensitive and subfolders can also be included.HTA Xcopy Tool Contributed by Christian Sawyer
Enables users to generate a complex command line with XCOPY using this friendly GUI. Every combination you can think is possible.List low-space partitions Contributed by Don Jones
This illustrates how to check each logical disk on a remote (or local) machine to see which disks, if any, are low on disk space. Shows how to calculate the "low space" (it's set to 20% remaining) and how to query and work with the class instances.makeshortcut.vbs Contributed by Kirk Patten
Create shortcuts from the command line. Useful for installation scripting or remote support.Retarget remote shortcuts Contributed by Bo Young
This script takes an ini file for input, and can reach out to multiple computers to retarget shortcuts. Useful for when the target of a shortcut is moved. Notifies users of the change if possible.Rotate IIS Log Files Contributed by Don Jones
You''ll need to make a copy of this for each server/web site you want to archive. It moves yesterday''s log file into an archive path (which can be a UNC), and then deletes the archived file from "x" days ago, so you can maintain (for example) an even 90 days of log files.Share a folder using WMI and VBScript Contributed by Marshall
This is how to share a folder using WMI and VBScriptUpdateLogArchive Contributed by Jim Vierra, Token, Christian Sawyer
Original script for this purpose has been written by Tim67. Then Jim, token and me started to optimize it as far as possible. Thank's to each members having participating in this optimization.Who Has a File Open Contributed by Don Jones
This uses the helpful WinNT ADSI provider to connect to any server (Windows 4.0 or later, if it has ADSI installed). It asks for a file name - which must be a local path as it sits on the server, not a UNC - and tells you who, if anyone, has that file open. Due to some vagaries in how ADSI works, this doesn't work on EVERY machine, but it's been tested in 4.0, 2000, 2003, and XP with good results.WMI enumerator Contributed by Satej
This scripts enumerates DACL for the folders and its subfolders.It uses Associated Class to combine Win32_directory and Win32_subdirectory Classes.Using Win32_logicalfilesharingsecurity class enumerates DACLS for each folder.WMI shield Contributed by Satej C Mirpagar
This script monitors the "creation" of a specific file which is dropped by the virus.As soon as it finds the file,deletes the file.Also deletes all the associated files and the registry entries for the virus.If thats not enough it isolates the system from the network [ only if DHCP is used ] and starts Antivirus scan.After the Scan is complete [ the termination of Scan is user-driven ] it reenables the network and connects to the link for detail information about Virus and latest updates for the Antivirus. It also has feature of disabling system restore,but that I have kept that as a option. TESTED ON: The script was tested on various platforms [ winXP,win2k3 ]for W32.BlackMal.E worm Result:About 70% of infected files were removed by the scripts. Assumption: The scripts assumes that the system uses DHCP and is virus-free.