Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - registry keys

Reply
 
Old 08-07-2009   #1 (permalink)
NewGuy


 
 

registry keys

I am pretty new to vbs and want to write a pure vbs (no html) that will do a
few things concerning the desktop background for a current user. I know
that the current background image is kept in the registry at
HKEY_CURRENT_USER>Control Panel>Desktop>Wallpaper(REG_SZ)

1. I want to be able to copy the whole key straight out of the registry and
save it to a user folder on my network.
2. I want to be able to read the string (path) of the key so I know exactly
what image I need to save (where it lives) since they could be using an IE
wallpaper or a windows one...no way to tell without manually digging.
3. I want to be able to add either add the whole key back to the registry
and/or
4. I want to be able to write a new string directly back to the key once it
is added.

Reason being is my boss wants this done. He wants our corporate image saved
to everyones profile when ever we have to create a new profile for someone,
but he still wants to save their old wallpaper too, so they can change it
back on their own. He says that way he is still carrying out the company
standard, but the customer can still change it back if they want to so they
will be happy too. He says that way neither corporate or the customers can
complain. Any help that points to some really straight forward examples (or
if you have some code yourself) would be greatly appreciated....

NewGuy



My System SpecsSystem Spec
Old 08-07-2009   #2 (permalink)
NewGuy


 
 

Re: registry keys

I found some code at msdn, but I am missing how to snag the actual string
data within the key itself. They show how to get the DWORD values but not
the string values.

const HKEY_CURRENT_USER = &H80000001
strComputer = "."
Set oReg=GetObject( _
"winmgmts:{impersonationLevel=impersonate}!\\" &_
strComputer & "\root\default:StdRegProv")
strKeyPath = "Control Panel\Desktop"
strValueName = "Wallpaper"
oReg.GetDWORDValue _
HKEY_CURRENT_USER,strKeyPath,strValueName,dwValue
WScript.Echo "Wallpaper Path = " & strValueName

Any help would be great!

NewGuy

"NewGuy" <dontemailme@xxxxxx> wrote in message
news:e4Nlux2FKHA.3392@xxxxxx
Quote:

>I am pretty new to vbs and want to write a pure vbs (no html) that will do
>a few things concerning the desktop background for a current user. I know
>that the current background image is kept in the registry at
>HKEY_CURRENT_USER>Control Panel>Desktop>Wallpaper(REG_SZ)
>
> 1. I want to be able to copy the whole key straight out of the registry
> and save it to a user folder on my network.
> 2. I want to be able to read the string (path) of the key so I know
> exactly what image I need to save (where it lives) since they could be
> using an IE wallpaper or a windows one...no way to tell without manually
> digging.
> 3. I want to be able to add either add the whole key back to the registry
> and/or
> 4. I want to be able to write a new string directly back to the key once
> it is added.
>
> Reason being is my boss wants this done. He wants our corporate image
> saved to everyones profile when ever we have to create a new profile for
> someone, but he still wants to save their old wallpaper too, so they can
> change it back on their own. He says that way he is still carrying out
> the company standard, but the customer can still change it back if they
> want to so they will be happy too. He says that way neither corporate or
> the customers can complain. Any help that points to some really straight
> forward examples (or if you have some code yourself) would be greatly
> appreciated....
>
> NewGuy
>

My System SpecsSystem Spec
Old 08-07-2009   #3 (permalink)
Pegasus [MVP]


 
 

Re: registry keys


"NewGuy" <dontemailme@xxxxxx> wrote in message
news:e4Nlux2FKHA.3392@xxxxxx
Quote:

>I am pretty new to vbs and want to write a pure vbs (no html) that will do
>a few things concerning the desktop background for a current user. I know
>that the current background image is kept in the registry at
>HKEY_CURRENT_USER>Control Panel>Desktop>Wallpaper(REG_SZ)
>
> 1. I want to be able to copy the whole key straight out of the registry
> and save it to a user folder on my network.
> 2. I want to be able to read the string (path) of the key so I know
> exactly what image I need to save (where it lives) since they could be
> using an IE wallpaper or a windows one...no way to tell without manually
> digging.
> 3. I want to be able to add either add the whole key back to the registry
> and/or
> 4. I want to be able to write a new string directly back to the key once
> it is added.
>
> Reason being is my boss wants this done. He wants our corporate image
> saved to everyones profile when ever we have to create a new profile for
> someone, but he still wants to save their old wallpaper too, so they can
> change it back on their own. He says that way he is still carrying out
> the company standard, but the customer can still change it back if they
> want to so they will be happy too. He says that way neither corporate or
> the customers can complain. Any help that points to some really straight
> forward examples (or if you have some code yourself) would be greatly
> appreciated....
>
> NewGuy
You can re-invent the wheel with some fairly complex VB script or else you
can build on what others have already done for you. The following command
will extract the wallpaper details for you:

reg query "hkcu\Control Panel\Desktop" /v wallpaper

You could also use reg.exe to modify an existing key.


My System SpecsSystem Spec
Old 08-07-2009   #4 (permalink)
NewGuy


 
 

Re: registry keys

Pegasus,

I am a true noob to programming, what would you recommend to capture the
string data (shell.application, wscript.shell, fso)?

NewGuy

"Pegasus [MVP]" <news@xxxxxx> wrote in message
news:e9Ccu13FKHA.3396@xxxxxx
Quote:

>
> "NewGuy" <dontemailme@xxxxxx> wrote in message
> news:e4Nlux2FKHA.3392@xxxxxx
Quote:

>>I am pretty new to vbs and want to write a pure vbs (no html) that will do
>>a few things concerning the desktop background for a current user. I know
>>that the current background image is kept in the registry at
>>HKEY_CURRENT_USER>Control Panel>Desktop>Wallpaper(REG_SZ)
>>
>> 1. I want to be able to copy the whole key straight out of the registry
>> and save it to a user folder on my network.
>> 2. I want to be able to read the string (path) of the key so I know
>> exactly what image I need to save (where it lives) since they could be
>> using an IE wallpaper or a windows one...no way to tell without manually
>> digging.
>> 3. I want to be able to add either add the whole key back to the
>> registry and/or
>> 4. I want to be able to write a new string directly back to the key once
>> it is added.
>>
>> Reason being is my boss wants this done. He wants our corporate image
>> saved to everyones profile when ever we have to create a new profile for
>> someone, but he still wants to save their old wallpaper too, so they can
>> change it back on their own. He says that way he is still carrying out
>> the company standard, but the customer can still change it back if they
>> want to so they will be happy too. He says that way neither corporate or
>> the customers can complain. Any help that points to some really straight
>> forward examples (or if you have some code yourself) would be greatly
>> appreciated....
>>
>> NewGuy
>
> You can re-invent the wheel with some fairly complex VB script or else you
> can build on what others have already done for you. The following command
> will extract the wallpaper details for you:
>
> reg query "hkcu\Control Panel\Desktop" /v wallpaper
>
> You could also use reg.exe to modify an existing key.
>

My System SpecsSystem Spec
Old 08-07-2009   #5 (permalink)
NewGuy


 
 

Re: registry keys

I fugured it out by playing with the example I posted earlier...just changed
DWORD to SZ...

const HKEY_CURRENT_USER = &H80000001
strComputer = "."
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &
strComputer & "\root\default:StdRegProv")
strKeyPath = "Control Panel\Desktop\"
strKeyName = "Wallpaper"
oReg.GetSTRINGValue HKEY_CURRENT_USER,strKeyPath,strKeyName,szValue
WScript.Echo "Wallpaper Path = " & szValue

New Guy


"NewGuy" <dontemailme@xxxxxx> wrote in message
news:e$s%23KT4FKHA.4004@xxxxxx
Quote:

> Pegasus,
>
> I am a true noob to programming, what would you recommend to capture the
> string data (shell.application, wscript.shell, fso)?
>
> NewGuy
>
> "Pegasus [MVP]" <news@xxxxxx> wrote in message
> news:e9Ccu13FKHA.3396@xxxxxx
Quote:

>>
>> "NewGuy" <dontemailme@xxxxxx> wrote in message
>> news:e4Nlux2FKHA.3392@xxxxxx
Quote:

>>>I am pretty new to vbs and want to write a pure vbs (no html) that will
>>>do a few things concerning the desktop background for a current user. I
>>>know that the current background image is kept in the registry at
>>>HKEY_CURRENT_USER>Control Panel>Desktop>Wallpaper(REG_SZ)
>>>
>>> 1. I want to be able to copy the whole key straight out of the registry
>>> and save it to a user folder on my network.
>>> 2. I want to be able to read the string (path) of the key so I know
>>> exactly what image I need to save (where it lives) since they could be
>>> using an IE wallpaper or a windows one...no way to tell without manually
>>> digging.
>>> 3. I want to be able to add either add the whole key back to the
>>> registry and/or
>>> 4. I want to be able to write a new string directly back to the key
>>> once it is added.
>>>
>>> Reason being is my boss wants this done. He wants our corporate image
>>> saved to everyones profile when ever we have to create a new profile for
>>> someone, but he still wants to save their old wallpaper too, so they can
>>> change it back on their own. He says that way he is still carrying out
>>> the company standard, but the customer can still change it back if they
>>> want to so they will be happy too. He says that way neither corporate
>>> or the customers can complain. Any help that points to some really
>>> straight forward examples (or if you have some code yourself) would be
>>> greatly appreciated....
>>>
>>> NewGuy
>>
>> You can re-invent the wheel with some fairly complex VB script or else
>> you can build on what others have already done for you. The following
>> command will extract the wallpaper details for you:
>>
>> reg query "hkcu\Control Panel\Desktop" /v wallpaper
>>
>> You could also use reg.exe to modify an existing key.
>>
>
>

My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Re: How can I delete registry keys Vista installation & setup
What are these Registry Keys? Vista General
RE: Missing Registry Keys Vista hardware & devices
Re: Missing Registry Keys Vista hardware & devices
BUG? Registry keys with / in names PowerShell


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46