?
Solved

Check Windows version then echo registry settings

Posted on 2014-03-19
3
Medium Priority
?
499 Views
Last Modified: 2014-03-19
Hi All,

I need to check which version of windows is running first then I need to check registry settings and echo what is the current setting.

After that I need to be able to change it through a input box and verify that the change has taken place.

Can anyone please help. I have not been able to figure it out.

Thanks,
Vicki
0
Comment
Question by:Vicki05
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 27

Accepted Solution

by:
MacroShadow earned 2000 total points
ID: 39940238
Not sure exactly what the workflow is, so I'll give you some snippets that you can put together.

This will return the installed OS:
strComputer = "."
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\"  & strComputer & "\root\cimv2")
Set colOperatingSystems = objWMIService.ExecQuery ("Select * from Win32_OperatingSystem")
For Each objOperatingSystem in colOperatingSystems
    Wscript.Echo objOperatingSystem.Caption & "  " & objOperatingSystem.Version
Next

Open in new window


This will return the value of a registry key:
Const HKEY_CLASSES_ROOT 	= &H80000000
Const HKEY_CURRENT_USER 	= &H80000001
Const HKEY_LOCAL_MACHINE 	= &H80000002
Const HKEY_USERS 		= &H80000003
Const HKEY_CURRENT_CONFIG 	= &H80000005
strComputer = "."
Set objRegistry = GetObject("winmgmts:\\" & strComputer & "\root\default:StdRegProv")
strKeyPath = "Software\YourSoftware\Settings"
strValueName = "Setting"
objRegistry.GetStringValue HKEY_CURRENT_USER, strKeyPath, strValueName, strValue
Wscript.Echo strValue

Open in new window


This will change a value of a registry key based on inputbox:
Const HKEY_CLASSES_ROOT 	= &H80000000
Const HKEY_CURRENT_USER 	= &H80000001
Const HKEY_LOCAL_MACHINE 	= &H80000002
Const HKEY_USERS 		= &H80000003
Const HKEY_CURRENT_CONFIG 	= &H80000005
strComputer = "."
Set objRegistry = GetObject("winmgmts:\\" & strComputer & "\root\default:StdRegProv")
strKeyPath = "Software\YourSoftware\Settings"
strValueName = Inputbox("Enter New Value.")
objRegistry.SetStringValue HKEY_CURRENT_USER, strKeyPath, strValueName, strValue
Wscript.Echo strValue

Open in new window


Note:
In the objRegistry.SetStringValue line change HKEY_CURRENT_USER to match the hive containing your key.
0
 

Author Closing Comment

by:Vicki05
ID: 39940518
Hi MacroShadow,


I will try to use the solution you provided.


Thanks a lot.
Vicki.
0
 
LVL 27

Expert Comment

by:MacroShadow
ID: 39940636
You're welcome.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
This article will show how Aten was able to supply easy management and control for Artear's video walls and wide range display configurations of their newsroom.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Suggested Courses
Course of the Month7 days, 23 hours left to enroll

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question