Browse CLASSROOM TRAINING Find ONLINE TRAINING CONTACT us

SAPIEN Solutions

SAPIEN homepage
PrimalScript script editor+ide
PrimalScope script debugger
Free Tools script utilities
SAPIEN Press tech books
ScriptingAnswers.com learn+share
ScriptingOutpost.com online store
Blog.Sapien.com official blog
Contact Us

 

Welcome to the ScriptVault, where ScriptingAnswers.com users share their administrative scripts.

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 > Registry

Contribute to this category


Sub-Categories

(no categories are available)

 

Scripts

Delete a Group of registry keys Contributed by Michael Brierley
I needed to remove a bunch of registry keys from computers. The only catch for this is the HKCU. If multiple users log into that machine, the only HKCU key that will get deleted will be the one for that user. I'm sure there is a way around that but it was just a hack in the first place :)
Get NIC information from a bulk of computers on your network Contributed by Kasiviswanathan P
This script will fetch the active Network interface card present on a bulk of computers across your network. Input values on serverlist.txt and get the output in any form (.txt/.csv/.xls). Command is cscript getNICInfo.vbs >output.csv
OSComputer NameIP Contributed by JFV
I created this script for those users on my network that have a hard time following directions over the phone to get their Computer Name, OS, or IP. I got the IP Code from elsewhere, but improved it to add up to 3 IP Addresses and no 0.0.0.0 addresses. Enjoy and let me know how you like it! JFV
RegRead Exampe - Determines OS Product Name, Product Version & Build Contributed by Marshall
I wrote this intially with the intent of running it remotely, but the limitations of RegRead prevented that and I decided to go with anothersolution (one that uses WSH Exec to call 'REG.EXE') -- I've held onto it because it's a good example of how to use RegRead to 'read' the value of a registry key and output that value to a file.
Setting a Binary Registry Key (of value) Contributed by Marshall
Recently I was asked to assist with an implimentation of a new application system. It needed to be deployed to 200+ desktops across 15 sites. While thumbing through the implimentation documentation I noticed the following lines of text that would make any WSH enabled admin cringe. Step 17: Log on to the workstation Step 18: Perform ipconfig /all to retrieve the MAC address (write it down) Step 19: Open REGEDIT and add the MAC address to the following subkey.... The thought of people all over the U.S. doing this manually made me a bit nutz. My site only had 15 workstations but still, the thought of hitting the sneaker net to perform such a mundane task didn't sit well with me, so to save myself, and my colleges at future implimentation sites a lot of trouble I started to script. The interesting problem that I encountered I why I'm sharing with you today. You see I thought, initially, that I could just: 1) Use WMI to read the MAC address (Win32_NetworkAdapter) 2) Use RegWrite to push the MAC into the registry key 3) Done What I didn't know at the time was that RegWrite doesn't do Binary (REG_BINARY).... Well... it technically does, but not in multiple sets (like a MAC address) You could write the number "1" for example, but beyond that, its very limited. I overcame the situation by writing a temporary REG file and using WshShell.Run to execute the reg (/s silent) The following script illustrates what I did to overcome the Binary problem. It also shows the use of TextStream to write a file, the use of a SUB to grab WMI information and WshShell to run a command. I hope you find it useful!
Simple PowerShell Registry manipluation demo Contributed by Charles
Demonstrates cmdllets manipulating the registry: Key add, rename, move, copy and delete; Value (including "(Default)") add, rename, copy, set, unset (empty and clear)and delete. May be useful to novices or as templates.
SourcePath by OS Contributed by Kirk Anger
This script reads from a text list of computer names and performs a ping test to determine if the computer is reachable. If so, it determines the OS and sets the SourcePath registry key to a network share where the files are located based on the OS. If the computer is not reachable, it will write that computer name to a list to be run against later.
Writing a REG_BINARY with VBScript Contributed by Marshall
This past week I came across an interesting situation. Interesting in that I hadn't encountered it before. A business system that I'm implimenting had, as a step on the installation sheet, to use IPCONFIG /ALL, write down the MAC address open up REGEDIT and edit a binary key. Well, with a dozen workstations spread across more than a dozen sites that didn't sound like the kind of busy work I wanted to ask anyone to do. Writing the script seemed pretty cut and dry. 1 - Use WMI to get the MAC Address 2 - Parse the MAC (to remove the ':''s) 3 - Write the parsed value to the registry VBScript I quickly noticed however presented a problem when I tried to use RegWrite to write a REG_BINARY. Seems that's not meant to be used to write a large binary value, or in this case a hex. Sure you can use it to write the number "1" to a binary value, but "00 05 5b bb 12"? Nope... Some would say I improvised to get around it (others claim I cheated lol!) -- but its just a reminder that there's more than one way to skin a cat and I thought it might be important to mention before anyone else has the pleasure of working RegWrite with REG_BINARY. Enjoy...