
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 > Computer Management
Contribute to this category
Sub-Categories
(no categories are available)
Scripts
Active Directory, Quick Workstation Inventory Contributed by wmi.wmi@gmail.com
Iterates through all computers in Active Directory. Ping's computers to determine if they are powered-on; if they are, it reports basic inventory data. If not, it reports unavailable systems and error state information. [Inventory objects collected include: OS, current logged-on user, manufacturer, model, service tag, processor type, memory, time zone, and daylight savings information.] Originally posted on http://addicted-to-it.blogspot.comAdd user account or group to local computer group Contributed by Rob Dunn
This script allows you to add user accounts to a (local or remote) workstation's local group such as the administrator or power users group.
The account running this needs to have administrative privileges on the computer it is run against.
Particularly useful if you are transitioning between trusted domains (migration), and have the same groups & user accounts on both...or, if you are creating a new domai-based support group, and need to add them to the local administrators group on each client.ArchiveEventLogs Contributed by Jim Vierra
The ArchiveLogs WSH package file is a framework for building collections of related jobs. Since related jobs have similar requirements for supporting functions and objects, I thought it would be useful to design and build a Framework for doing this. A WSF package exists as an XML document. This format allows multiple related or unrelated scripts to be stored in teh same file. What it lacks is the concept of an embedded library of functions shared across all jobs in the file. By adding a simple function we can leverage this XML file to contain numerous library scripts. To see the formatted XML in ArchiveLogs See Readme.htm in sip file.Auto Login for Windows Contributed by Frank D Mroz
I work for a college and all of our classrooms autologin to our domain. This script will prompt you for the username and then password with input boxes. Fill them in and you are set. If you need to change the users just run the script again and will change it.AutoLog Contributed by Mark Fairpo
Configure Auto-Login to NT/2000/XP only and disable the Novell Login screen. For Novell Client versions 4.7 thru 4.9 Similar to the ''Workstation Only'' checkbox. If the primary connection''s password expires when running the NetWare Login utility from the icon, then the user will be given the chance to synchronize all NetWare and NT passwords. Users should not synchronize the NT password, because NetWare Login does not update the Registry settings for auto-logon. Using AutoAdminLogon opens your network to a security risk, as it exposes user IDs and passwords and it lets any user who starts the workstation use these embedded credentials. Since writing this, this utility was discovered by Tommy Mikkelsen: www.novell.com/coolsolutions/tools/1035.html THIS BATCH FILE HAS NOT BEEN WIDELY TESTED. GREAT CARE HAS BEEN TAKEN TO ENSURE THAT THIS BATCH FILE PERFORMS AS IT SHOULD. IT IS PROVIDED "AS IS", BY USING THIS BATCH FILE, YOU AGREE TO USE IT AT YOUR OWN RISK.Batch-Disable System Restore Contributed by donj
A lot of companies like to turn off System Restore, for a number of reasons (including its potential to harbor viruses). Search Google and you'll see plenty of sites showing you how to manually turn it off... here's a script that'll turn it off on multiple XP computers. This script expects an input text file listing the computer names on which System Restore should be turned off. Please be sure to test this with 1-2 computers before letting it loose on your entire network.Bios Serial Read Contributed by WC
This Script queries LDAP provider (with WMI) for Computer names in a defined domain. (This must be configured in the script.) Then the computer is pinged to confirm connection, then if pc is reachable, WMI queries bios for the bios serial number. The results are written to an excel table. (File name and location can be changed in script. Of course, excel must be installed on the machine that runs the script.) Commented out is the option to display progress in a HTML window. Remove commented-out sections to activate this. Although tested in live domains, this script is offered as a demo only - non-final version. Please send comments and suggestion to wc@sneekco.deChange Admin Password on a list of Computers Contributed by Don Jones
Create a text file listing one computer name per line, and this script will change the local Administrator password on each (the password is hardcoded into the script).Change Admin Password on AD Computers Contributed by Don Jones
The password is statically set in the script; please be careful when running this as it does try to attach to EVERY computer in the domain!!Change local administrator password remotely Contributed by Christian Sawyer
Tired to change administrator account password on each workstation, server or DC? This script will do it for you with this useful free tool, RenameAdmin.exe. You can find it at http://home.comcast.net/~habullock/Perlutilities.htm. Once downloaded, unzip it in same directory as this script is and start the script. You can also use the tool to rename the administrator account the same way.Check disk and Defrag it Contributed by Christian Sawyer
This batch file can save you some time by automatically running Chkdsk and Defrag on your Windows XP machines.Check Disk Space HTA Contributed by Don Jones
Create a text file listing computers (one name per line). This HTA (a graphical tool) will allow you to specify a minimum amount of free disk space. It''ll connect to each computer and list any drives with free space under the specified threshold.Clear, reset WSUS ID on local or remote computer Contributed by Rob Dunn
This script is intended for those folks who are having issues with their clients not reporting into WSUS properly because of a duplicate SIDs.
This script can be run against a local/remote computer and delete the WSUS Client ID's and then force the computer to run a detectnow or resetauthorization, which hopefully will result in allowing the PC to report back into the WSUS server with a newly generated ID.
See the script content for full documentation.computer_inventory.vbs Contributed by Max Parker
Vbscript that remotely access computers and retrieves information such as software installed, printers installed, operating system, Network Adapter information, Hotfixes installed, plug and play devices installed, memory, free space and writes to a MSAccess Database. If no Database exists in the folder where the script resides, it will create a database. Works best if run from an XP machine.Configure DNS and WINS Contributed by Sean McNeill
This Script will promt for a computer name, connect to the computer via WMI and enumerate all IP Enabled adapters and list the DNS and WINS servers. The user will then have the option to change either DNS or WINS and continue until they are done changing settings. It is pretty rough but functionalCreate shortcuts Contributed by Don Jones
This simple script shows how to create a new shortcut and set its properties. This technique might be useful in a logon script or a new computer configuration script where you want to consistently create several new shortcuts at once. Note that the SpecialFolders("x") function won't work on all versions of Windows; you may need to change that to a straight folder path if you experience problems. Also, TargetPath needs to be set equal to the actual path of the executable.CreateShortcuts.vbs Contributed by Christian Sawyer
Allow to create 15 IE shortcut in a folder created also by this script on the Desktop. You can change any value as you wish.Determine System uptime Contributed by Zander
Takes a list of machines and returns system uptime in hoursDisable Wireless Cards Contributed by David Davis
You must download devcon from microsoft @ http://support.microsoft.com/default.aspx?scid=kb;EN-US;Q311272. You must change 4 variables labled REPLACE THIS. The script will look for the existance of a wireless card on any system. If found it examines the properties to check if it is enabled. If it is it will disable it. This script was written to run as a startup script in Active Directory. It can be modified for other functions as well.Disk Space Monitor with Email Alert Contributed by Jason Baxter
This can be scheduled with Windows Scheduler as I currently have it setupDomain Computer Uptime Contributed by James Vierra
Script retrievs all computers from AD in the domain. Calls WMI to get last boot time and returns days and hours since last boot. Works on W2K, WXP, WS2003 and W9x.Enumerate and ping computers in AD Contributed by Marcus Rose
This script is the basics of weeding out computers that are not responding to pings before doing a WMI query by.. Enumerating Comuters/Servers in a specific OU or container then pinging the computers then validating responce to WMI.Force download and install of WSUS updates v2.11 Contributed by Rob Dunn
This script (the core was pulled from Microsoft's website, and the WindowsUpdate agent install was borrowed from Torgeir Bakken - thank you!) will tell the WU agent to 'detectnow', download and install missing windows updates as compared to it's update server. Works for WSUS and regular Windows Update site. The script can reboot the computer if specified after the udpates have been applied (or if there is a reboot pending from a previous update session). NOTE: If there are a LOT of downloads to pull, the status window (or log) will say "Downloading" for that entire time. I'm not sure how to get a download progress of each update... Note on command-line switches: If you don't specify a switch (for example, 'email:') the corresponding variable defined in the script will provide the needed information (command-line switches take precedence. Why I put this script together: Our desktop deployment technicians needed a script that would pull updates immediately and install. We have some computers that are sometimes logged on or not (but they run services that must be running almost constantly), and are never rebooted. The user ignores the 'you have new updates available' message, so updates are never installed. This script will let you install the updates, and then it tells the WUA to present the 'restart' message - which more users are apt to respond to. If the client running the script doesn't have the 2.0 WUA installed, Torgeir's portion of the script will automatically install it (please contact me if this doesn't work - I modified his script slightly to plug into mine!). After the script runs, it will email a recipient the resulting logfile that is produced. You need to edit the following variables: sExePath - this is the location of the WindowsUpdateAgent20-x86.exe. Download it from http://go.microsoft.com/fwlink/?LinkId=43264 strMailFrom - arbitrary reply-to address strMailto - email address you want the report to mail to (this is for manual mode - or if the command-line switch isn't specified). strSMTPServer - the IP address of the email server you are sending the reports through. Optional variables: Silent - 0 = verbose, 1 = silent (no windows or visible information) Intdebug - 0 = off, 1 = 1 (see some variables that are being passed) strAction - prompt|install|detect. Prompt gives users opportunity to install updates or not, install just installs them, detect updates the WU collection and downloads the updates (but does not install them) - useful if you want to have the computer refresh its stats to the stat server but not install the updates. blnEmail - 0 = off|1 = on. If set to 0, the script will not email a log file. If you specify an email address in the command-line, this will force the script to switch blnEmail to '1'. strRestart - 0 = Do nothing|1 = restart|2 = shutdown. Command-switch 'restart:' supercedes this variable. Command line switches: action: prompt|install|detect mode: silent|verbose email: you@yourdomain.com restart: 0 (do nothing)| 1 (restart) | 2 (shutdown) For more version history and the latest incarnation of this script, check here (I will try to update it here on this site as well): http://uphold2001.brinkster.net/vbshf/forum/forums/thread-view.asp?tid=199&start=1Force download and install of WSUS updates v2.5 (replaces v2.11) Contributed by Rob Dunn
This script (the core was pulled from Microsoft's website, and the WindowsUpdate agent install was borrowed from Torgeir Bakken - thank you!) will tell the WU agent to 'detectnow', download and install missing windows updates as compared to it's update server.
Works for WSUS and regular Windows Update site. The script can reboot the computer if specified after the udpates have been applied (or if there is a reboot pending from a previous update session).
For more version history and the latest incarnation of this script, check here (I will try to update it here on this site as well): http://www.vbshf.com/vbshf/forum/forums/thread-view.asp?tid=199&posts=163&start=1Get Computer Role Contributed by Jim Vierra
Use WMI to retrieve and decode the computer role. WOrks in or out of domain. File comprised of function and driver for test. Since LDAP and WinNT providers cannot read the "Role" in Active Directory this WMI class is needed in scripting to read the AD role of a computer. It calls the computer in question and asks it what it's role is. WMI can correctly read teh AD "Role" property of teh IADSComputer class. Returns "standalone server" or "standalone workstation" in a domain.Install MSI Application based upon group membership Contributed by Rob Dunn
Description:
This script will help you install a particular application based upon user membership in a particular domain group. Installmsiapp will check the computer's installed (MSI) applications, see if it can find the requested software title, then install the app if it is missing, and if the logged in user is a member of the requested domain group (no nested groups currently)
Note that this is for MSI-packaged applications ONLY.
When the msi installs, it will use the /passive msiexec.exe command-line switch, which only shows a progress bar, but no other intervention is necessary.
This script is particularly useful for deploying applications via the logon script, but you don't want to go the route of deploying via GPO (or if perhaps the GPO isn't working properly with a third-party MSI).Inventory all computers in AD Contributed by Chris Lynch
VBscript that will gather information about your servers and computer via WMI. This script used LDAP to bind to Active Directory to search for the computer objects. If you have an NT4 domain, the code will have to be modified. I'm working on a newer version that will attempt to bind to the WINNT provider, and if it errors out, then it will use LDAP. This script was converted from JScript to VBscript. The script was originally created by Leslie Maclachlan, so thanks to Leslie. This script will check the servers to make sure necessary components are running, and that the servers are not running out of disk space. etc.etc.Inventory Your Servers Contributed by Patrick Ogenstad
SYDI-Server helps system administrators with the task of documenting their Windows Servers. It uses WMI to collect information, the output can be written to XML or Microsoft Word. The package also has an option to create an overview in Excel to list multiple computers.”IP info to Excel report Contributed by kradneb
Retrieve PC Name, Mac address, IP address, OS name OS Service Pack, OS Registered User in a domain and fill anExcel file with this information. Alow to find problem of certain PC because more than one NIC had same MAC address. This situation will happen if you don't have DNSserver and you use DHCP feature from CISCO PIX Router or other type of router. Consequences: 2 PC with same Mac Address obtain same IP Address from DHCP. Both see network but they don't see each other.Kill-Monitor-Kill v.2 Contributed by Kevin Shannon
This script is an updated version of a few different scripts combined together (I apologize, for I do not have the author names to reference them properly.) The script will stop and disable select services on remote workstations, stop select running processes, log actions to a log file, and actively monitor asynchronously to stop and disable in real-time. Works best if ran from Windows XP. More detailed instructions are in the comments of the .vbs file.Launch Remote App Contributed by Don Jones
This starts Notepad, but you could obviously start any application.
Note: When starting a GUI-based app on a remote machine, the user of that machine won't necessarily be able to SEE the app. So this is best used for starting background apps that don't use a GUI.List Computer StartUp Apps Contributed by Shane Boudreaux
Lists all applications in your Start Up and logs to a local file. The script uses a '^' as a delimiter for the output fields. I use this delimiter because i pull the results into a database automatically, where i've defined the import function to parse log into fields based on '^' as the delimiter. IDEA: Roll script out via group policy to your clients. Have the script output logged to a location on your network. Concatenate all logs into one file for importing into a database (access, mssql, mysql, whatever). Now you've got a database of what's starting up on your clients' workstations. With a little research and development on your database, you could easily build this into a reporting feature for spyware or applications that you'd want to remove from your clients' workstations!List Remote Processes Contributed by Don Jones
Returns the process name and ID for each process running on the targeted computer. As written, it only looks for processes named "Notepad.exe;" remove the "WHERE Name='notepad.exe'" from the query to list all remote processes.List shares on multiple computers Contributed by Don Jones
Provide a list - one computer name per line - and this will display the shares (and the corresponding physical paths) on the computer.Lock Workstation Contributed by Don Jones
As written, this will only work against the local machine. However, you could use WMI to start this process on remote machines, too.Lock Workstations Contributed by Don Jones
This runs a DLL which locks the workstation - the DLL is part of Windows, so it'll always be present. You could create a script which uses the Win32_Process WMI class to remotely launch this DLL on remote machines, thus remotely locking workstations (say, at the end of each workday).Logoff, Restart or Shutdown Remote PCs Contributed by kradneb
LogOff, Restart, ShutDown or PowerOff a specific machine or all machine in a domain. Verify if machine(s) is/are reachable using ping.exe command line tool. Verify also if arguments passed on command line are correct and validate runtime program used. If not, will change it. Finally, generate a report of reached and unreached machine in an Excel file for all machine in domain. Do not apply for one remote PC.monitor network devices from a db output to excel Contributed by Rick Ziminski
This script queries a database for a list of "devices" (in my instance they are time clocks, simple tcp devices that records swipes from a badge. the "device" operates on TCP has an telnet access and a web interface. any one of those could be down and hence "not working". So this checks a db for the list of active clocks and then checks them, sending the output to excel.Nightly Reboot Contributed by Patrick Davie
In order to force a reboot on a system, I added this bit to our logon script. It adds a task to reboot the machine at 3:25 AM every night. We also have a GPO called ''Blocked GPO'' in order to have servers not get this...the admin logon we use for he servers are not on there. Its quick and dirty but it works.NumLock, CapsLock, ScrollLock Randomizer Contributed by Kevin Shannon
Want to mess with other SysAdmins or Users? (Or make pretty lights on your keyboard?) This .vbs script will toggle on and off the Number Lock, Caps Lock, and Scroll Lock on local or remote workstations. The instructions for executing on remote workstations is in the .vbs comments.Performance Monitor Contributed by Adam Hayes
======================
I. Purpose of the Script
======================
The purpose of this script is to gather performance data from multiple Windows-based computers. This script reads this data from the built-in Windows Management Instrumentation (WMI) objects and outputs the results to a file. By default, the script retrieves the following performance counters: * Percent Total CPU Utilization * Pages per Second * Total Bytes of Committed Memory * Total Current Logical Disk Queue Length * Total Number of Processes Running
A full ZIP download of the script and a readme file can be found HEREPingHost_W2K_XP Contributed by Jim Vierra
Ping from W2K or XP. Chooses method at runtimePowerShell Get diskspace -lt 1GB & email admin Contributed by Brian Butler
Take a text file file of computers, and report disk space. If the space is less then your specified value send an email to the administrator to let him know.Reboot a COmputer and Wait for it. Contributed by James Vierra
I need to reboot computers at times and then do some other task afterwards. In teh past I would start a CMD ping and wait for it to succeed. While this is ok with one CPU it becomes a headache when ding multiple modifications. I create this script to simplify my needs. It can stand alone or the subroutines can be cut and pasted into other scripts as needed. Usage is listed in the "Comments" at the head of the script. I have tested this fairly well on m y own domains but it has not been tested in every configuration. It works with XP, W2K and WS2003 so far. The ping timings are only adjustable by editing the script. I hhave done this for the sake of simplicity. If you have older slower hosts you may need to increase the timeouts. TIMEOUT_PING_SUCCESS = 60 TIMEOUT_PING_FAIL = 120 In some systems the shutdown can take up to 5 minutes or longer. Restart can take 3 to 5 minutes. These settings will work with most XP and W2K Pro clients with no extensive services running. If you combine this in your own scripts you can use it to wait for a host to return before installing teh next piece of software. The main function returns True or False. By calling the WaitForPing separately you can wait longer or retry the wait. The functions do not check to see if the services are all running. I will add that at a later time (when I need it) but you need to wait for that to occur before doing many things as the Network is pingable even before the box will allow connections. Most MS API and WMI calls will wait on a box that is restarting if it is pingable when the call starts.REGVIEW Contributed by Mark Fairpo
By Mark Fairpo in response to Brian Grainger''s articles on www.icpug.org.uk This VBScript allows Technicians to run RegEdit when registry editing is policy-disabled. Policy permissions over modifying the Registry Hives remain in-place.Remotely kill a process Contributed by Graeme Stephens
remotly kill a process on a remote machine using WMI change the COMPUTERNAME to the remote machine name change 'cmd.exe' to the name of the program you want to killRetrieve Mac address and IP info to Excel report Contributed by Christian Sawyer
Retrieve PC Name, Mac address, IP address, OS name OS Service Pack, OS Registered User in a domain and fill anExcel file with this information. Alow to find problem of certain PC because more than one NIC had same MAC address. This situation will happen if you don't have DNS server and you use DHCP feature from CISCO PIX Router or other type of router. Consequences: 2 PC with same Mac Address obtain same IP Address from DHCP. Both see network but they don't see each other. This is a revision of previously posted script (IP Info to Excel). There was bug in GetOS() and SaveSpreadSheet()Retrieve ping status code to an Excel file Contributed by Christian Sawyer
Will run from Windows 2000 workstation as well as from XP or Windows 2003. You need Excel installed on the PC from where you run this script. Command line window will appear if started from a Windows 2000 Workstation/server.Service Pack Inventory Database Contributed by Don Jones
Expects an Access database at c:\data.mdb to contain a table named Data. That table must have columns names ServicePack and Client. The Client column can be populated with computer names; this script will fill in the service pack level of each.Service Pack Inventory Contributed by Don Jones
Will contact each computer listed in computers.txt (input file) and write their current service pack to results.txt (output file). Basic error logging for unreachable computers.Show computer service back and build HTA Contributed by Don Jones
This graphical tool lets you quickly check service pack and build number.Shutdown multiple computers Contributed by donj
This is a column I wrote for Microsoft Certified Professional Magazine. After my February feature, “Automate Your Security,” with VBScript, I received a lot of requests for a script that would remotely log off remote users and even remotely shut down their computers. What a great idea! So, I decided to see if it could be done with VBScript and Windows Management Instrumentation (WMI)—and it can. You'll need to create a text file named "c:\clients.txt" using Notepad. This file should contain one computer name per line, listing all the computers you want the script to shut down.System Cleanup Contributed by Patrick Wilshusen
This script is designed to go through and delete temporary files on a Windows 2000 system. It will delete files and folders in the c:\winnt\temp directory. It will delete patch and service pack uninstall information that is over 30 days old It will delete from the individual user profiles the temp directory, the History, and the temporary internet files. This script was designed to save manual steps of going through our systems and manually doing these process. It is designed for Windows 2000, but could easily be modified for XP.System Information Report with WMI Contributed by jhicks91
WMIC is a terrific command line tool for managing systems in your network. There are a number of formatting options available as well so you can build on-the-fly reports for archival or troubleshooting purposes. This batch file is essentially a wrapper for WMIC that builds an html page. It can be run from any XP or 2003 system and connect to any system running WMI.UNC logon and shortcuts Contributed by Theresa Heroff
This script tests for group membership, creates UNC paths and desktop shortcuts.Uninstall remote apps I Contributed by Don Jones
Only works with applications that have been installed with Windows Installer (MSIs). This will use WMI to iterate each installed application, and allow you to uninstall each one in turn. Use the principles shown to write scripts which remotely uninstall a desired application on multiple computers.Uninstall remote apps Contributed by Don Jones
Uses WMI's Installed Applications class to uninstall a specified application from a remote computer. This script will list all installed apps and let you uninstall each one, if desired.VirusTest Contributed by Cade A. Fassett
This script is designed to test the effectiveness of your antivirus software using a benign test file. Uses the EICAR.COM benign anti-virus test file from eicar.com. The file is dynamically generated by the script, and attempts are made to copy the file to a list of remote machines and execute. Any failures in this process are logged. Note that this script uses numerous functions for the tests. Every function returns a binary TRUE if the operation was successful and a binary FALSE if the operation was unsuccessful. Input to this script is in the form of a text file, for which I use C:\shares.txt. If you have antivirus software on your target machines which displays popup alerts to inform users of infected files, then I highly recommend that you inform your users before you run this script. Even though the EICAR.COM file is 100% benign, it will still trigger a normal alert from your antivirus software.Wake up PCs with VBScript Contributed by donj
I have a client who needed a way to automatically wake up multiple computers. The computers had a Wake-On-Lan (WOL) compatible network adapter, so it seemed scriptable. I'm positive there's a way to do this with plain WMI, but I had a devil of a time figuring it out. I did find a nice script control called UltraWOL, however, that seems to do the trick. You can get it at http://www3.sympatico.ca/manukian/. It only has to be installed on the machine running this script. Provide a text file named c:list.txt. This should include one MAC address per line, in the normal "00-00-AA-BB-11-22-33" MAC address format. Be sure to include the dashes! Of course, you'll want to modify the IP addresses appropriately for your environment. We knew all the necessary computers were contained within the Class C range used in this script - just modify the For...Next loop with your address ranges.WINSviaDHCP Contributed by Kevin Shannon
This script will change the WINS TCP/IP settings on a list of target workstations. Specifically, it will remove any static WINS server entries and set WINS to obtain via DHCP on the remote workstations. There are instructions in the comments of the .vbs file.WSUS Installed Updates Contributed by Aaron Castillo
The only modification you have to do on tihs script is change the computer names in the array "COMPUTER1" thru "COMPUTER3". Email me your comments cadstillo@hotmailDOTcom. Thanks and Enjoy.WSUS Windows Updates Contributed by Mark Fairpo
Filename: WindowsUpdates.wsf Description: Automatically downloads and installs relevant updates. Version: Modified WindowsUpdates.vbs 1.0 Notes: From the Microsoft Shared Computer Toolkit for WinXP. Closing its optional console window kills the task. See also %windir%\WindowsUpdate.log for another log. Large portions are Copyright (C) Microsoft Corporation 2005, Modifications to enhance its interface by Mark Fairpo. Commissioned within Hull-College.ac.uk for a resilient VBScript. For emphasis on functionality + support try updatehf.vbs by Rob Dunn http://uphold2001.brinkster.net/vbshf/forum For help use "WindowsUpdates /?" or "CScript WindowsUpdates.wsf /?"XP SP2 Data Execution Prevention exclusion list Contributed by Waynne
Script will change the Data Execution Prevention (DEP) settings in XP SP2 from Windows essential programs to all programs except those listed in the exclusion list. The list of executables are defined in a seperate text file which is read to create the registry values for the exclusions. The script makes use of direct changes to the registry to enable the changes.