VBS to display volume icon

I haven't been able to find a solution to my problem from reading other posts about this topic. I'm looking for a vbs that will "turn on" or display the volume icon in the system tray. I had one that seemed to work under XP-SP2, but it doesn't work with SP3. Does anyone have a down and dirty script that will do this? I've posted the code.
set objShell = CreateObject("Wscript.shell")
strComputer = "."
dim objReg
 
 
Set objReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & 
                     strComputer & "\root\default:StdRegProv")
 	strKeyPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\
                    ShellServiceObjectDelayLoad"
	strValueName = "SysTray"
	strValue = "{35CEC8A3-2BE6-11D2-8773-92E220524153}"
	objReg.SetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue

Open in new window

Francis515Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Francis515Author Commented:
Hmm, I guess I've asked something beyond the scope of this website.
0
merowingerCommented:
I don't know the registry path and maybe it changed from SP2 to SP3,
but you can just do the changes manually and capture which changes were made in the registry during the process.
To do this download the application regshot which allows registry captures!

1. First Shot (Capture Registry State befor)
2. Do your changes
3. Second Shot (Capture Registry State after)
4. Compare changes
0
Francis515Author Commented:
That was actually one of the first things I did. I tried to put together a script incorporating the changes listed in the comparison, but when I try to run the resulting script I get compilation errors and I don't know enough about programming to figure out how to make it work. The below code is what I came up with. The four lines of Hkey values after objReg.SetStringValue are what regshot reported back from checking the display volume icon in Sounds and Audio Devices Properties.
set objShell = CreateObject("Wscript.shell")
strcomputer = "."
dim objReg
 
set objReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")
 
objReg.SetstringValue HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography\RNG\Seed: 3E 04 6A 5A B8 1D 03 00 BF 03 16 E0 5F 99 5B 83 37 88 8B 33 04 39 ED 6D 2F A6 22 E6 95 98 67 EF 6D 85 48 CF 3C 8C 14 BB D2 90 75 D9 CC 3F 33 A2 21 2A 53 03 C9 5E F8 C1 78 43 93 64 C8 CE FB 49 A4 92 11 62 54 E9 E8 67 56 43 AF 87 C9 02 76 F5
objReg.Setstringvalue HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography\RNG\Seed: FB E6 DC 44 56 2C BF 2B B9 96 77 31 71 42 FC 2F A8 78 9B B6 DB 01 A6 40 E7 9D 23 E2 C1 62 5C F4 5B BF 19 9B DF 89 9E B2 10 82 3E 58 4B C4 16 66 44 F3 6F 26 92 76 57 97 71 D5 A6 69 0C 4F 62 33 1E 7F 02 8C B6 BF 98 9B 25 70 3D 8D 8B 97 54 45
objReg.SetstringValue HKEY_USERS\S-1-5-21-3590939585-530014914-281631138-2122\Software\Microsoft\Windows\CurrentVersion\Applets\SysTray\Services: 0x0000001B
objReg.SetstringValue HKEY_USERS\S-1-5-21-3590939585-530014914-281631138-2122\Software\Microsoft\Windows\CurrentVersion\Applets\SysTray\Services: 0x0000001F

Open in new window

0
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

merowingerCommented:
the Cryptography\RNG\Seed Keys are not needed, as this are registry changes which occur the whole time.

set objShell = CreateObject("Wscript.shell")
objShell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Applets\SysTray\Services: 0x0000001B
0
merowingerCommented:
forget the above listed code!!
You configured it worng. First try to just change the registry key manually to make sure that this is the correct one. Check out this: http://www.msfn.org/board/index.php?showtopic=82150&mode=threaded&pid=557285
0
Francis515Author Commented:
Trying to run that script throws a "Wrong number of arguments or invalid property assignment: objShell.RegWrite" error.
0
Francis515Author Commented:
The key listed on the msfn site doesn't work. If I try to import that statement I get "key selected is invalid" error.
0
merowingerCommented:
just try changing the keys from hand in the first step.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Francis515Author Commented:
No, manually adding the key/path from the msfn site did not display the volume icon.
0
Francis515Author Commented:
Sorry, please ignore the above comment. The icon did show up after rebooting.
0
Francis515Author Commented:
The final code I used that works great is attached. I included a routine to force a reboot.
dim WshShell
Set WshShell = WScript.CreateObject("WScript.Shell")
 
WshShell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Applets
              \SysTray\Services", "F", "REG_SZ"
 
 
 
'-------Force Computer Restart-----------------------------
 
Set OpSysSet = GetObject("winmgmts:{(Shutdown)}//.root
       /cimv2").ExecQuery("select * from Win32_OperatingSystem
        where Primary=true")
 
for each OpSys in OpSysSet
    OpSys.Reboot()
next

Open in new window

0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Programming

From novice to tech pro — start learning today.