|
|
|||||||||
|
|||||||||
|
|||||||||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Free Web 2.0 Code Generator! Generate data entry and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
|
|
#1
|
|||
|
|||
|
VBScript - Scripting and the Registry
How can I push registry settings out to a group of users? What scripting language should I use? Here are the registry settings:
[HKEY_CURRENT_USER\Software\Novell\GroupWise\Login Parameters] [HKEY_CURRENT_USER\Software\Novell\GroupWise\Login Parameters\Mode] @="Cache" [HKEY_CURRENT_USER\Software\Novell\GroupWise\Login Parameters\Path To Cache] @="c:\documents and settings\%username%\my documents\mailbox" Here's what I got so far towards this problem: On Error Resume Next Dim WshShell Dim AccountName Set WshShell = CreateObject("WScript.Shell") WshShell.RegWrite "HKCU\Software\Novell\GroupWise\Login Parameters\Path To Cache\", "C:\Documents and Settings\" & AccountName & "\My Documents\Mailbox", "REG_SZ" WshShell.RegWrite "HKCU\Software\Novell\GroupWise\Login Parameters" WshShell.RegWrite "HKCU\Software\Novell\GroupWise\Login Parameters\Mode\", "Cache", "REG_SZ" Set WshShell = Nothing I need to be able to read the User Name of the currently logged on user and use that information to populate the AccountName variable. I'm not quite sure where to find this information in the registry and the correct syntax to read the information. Thank you ahead of time for the help. |
|
#2
|
|||||
|
|||||
|
Perhaps the quickest method of retrieving the currently logged on user is by using the WshNetwork object. You can do this by adding the following code to your script.
vb Code:
As to your question of how to push these settings out to your users... The easiest method deployment is dependent upon the users you want to push this out to. Are you using a Domain server? The easiest method would be to include this in a logon script.
__________________
Click the image if at any point you don't like my decision.Scripting problems? Windows questions? Ask the Windows Guru! |
|
#3
|
|||
|
|||
|
The whole scope of this script has changed....
After looking at somethings and testing a few things, I need to change the way the script is used. Here's what I need:
1. Login Script that gets the current username and appends it to a text file, but I need to verify what profile the username is using under c:\documents and settings. For example, some of our users have and old profile e.g. JOSCHMO and a new profile JOSCHMO.DOMAIN. I need to verify they are using the current profile. 2. The login script then needs to reboot the computer with some messsage about Windows Updates. 3. A Startup Script that reads the username from the text file, makes the above registry changes and creates a folder in their my documents folder. It also needs to append some arguments to the target field of a shortcut in the all users profile. 4. It then needs to delete the text file. I am not a programmer, but I'm definately trying to understand and learn from this. I have some code, but I know it needs to be reworked. Any detailed help on this is greatly appreciated and I thank everyone ahead of time. Here is the code I have so far: ========================================== Getting the Username ========================================== On Error Resume Next Dim WshShell Dim objNetwork Dim AccountName LogFile = "C:\User.txt" Set WshShell = CreateObject("WScript.Shell") Set objNetwork = CreateObject("Wscript.Network") Set objFSO = CreateObject("Scripting.FileSystemObject") AccountName = obj.Network.Username If objFSO.FileExists(LogFile) Then objFSO.DeleteFile(LogFile) Exit Else Set objFile = objFSO.CreateTextFile(LogFile) objFile.Close Set objFile = objFSO.OpenTextFile(LogFile, ForWriting) objFile.Write AccountName End If objFile.Close Set WshShell = Nothing Set objNetwork = Nothing ============================================= Change GroupWise into Caching Mode ============================================= On Error Resume Next Dim WshShell Dim AccountName Dim objNetwork Set WshShell = CreateObject("WScript.Shell") Set objNetwork = CreateObject("Wscript.Network") Set objFSO = CreateObject("Scripting.FileSystemObject") AccountName = objNetwork.Username Set objFolder = objFSO.CreateFolder("c:\documents and settings\" & AccountName & "\My Documents\Mailbox") WshShell.RegWrite "HKCU\Software\Novell\GroupWise\Login Parameters\Path To Cache\", "C:\Documents and Settings\" & AccountName & "\My Documents\Mailbox", "REG_SZ" WshShell.RegWrite "HKCU\Software\Novell\GroupWise\Login Parameters" WshShell.RegWrite "HKCU\Software\Novell\GroupWise\Login Parameters\Mode\", "Cache", "REG_SZ" Set WshShell = Nothing Set objNetwork = Nothing ============================================= I'm not sure how to complete some of the above requirements, so I know these are incomplete. |
|
#4
|
||||
|
||||
|
Okay, the things you are suggesting can all be accomplished, but I'm slightly confused about exactly what you are trying to do. Let me rework your code a bit and see if I'm understanding what you're trying to do.
I'll post back. |
|
#5
|
|||
|
|||
|
What I'm trying to do...
I'm trying to automate the way you put users into Caching Mode in GroupWise. I have about 250 users I need to change. That's why I need the login script to get their username and append it to a text file on the local disk. The computer will then reboot and run the startup script, which will make the appropriate changes to the registry, create the mailbox folder in their My Documents folder, modify the GroupWise shortcut with the correct arguments after the path in the target field and then delete the text file from the disk. I appreciate all your help on this.
The key is that both scripts only run ONCE on each computer. |
|
#6
|
||||
|
||||
|
Okay, that makes things slightly more clear. Do me a favor. Post a list of all the registry changes you need to make along with the exact steps you need to take place in order. I'll write you a fully commented script to do job so that you can see how it all goes together. From there, you should be able to tweak it if necessary. Don't forget to include what the new shortcut should look like as well as what the path is to the old one.
Also, how will you be deploying this script? I need to know so that I can control how many times it runs. Will you be running this by setting a local logon script or will you be pushing this as a domain logon script? Last edited by Nilpo : April 9th, 2008 at 05:04 PM. |
|
#7
|
|||
|
|||
|
Here is the information..
Here are the registry changes
[HKEY_CURRENT_USER\Software\Novell\GroupWise\Login Parameters] [HKEY_CURRENT_USER\Software\Novell\GroupWise\Login Parameters\Mode] @="Cache" [HKEY_CURRENT_USER\Software\Novell\GroupWise\Login Parameters\Path To Cache] @="c:\documents and settings\%username%\my documents\mailbox" ========================================= Login Script ========================================= - Reads Username - Appends Username to text file - Reboots Computer ========================================= Startup Script ========================================= - Reads Username from text file - Makes Registry Changes - Creates Mailbox folder in the user's My Documents c:\documents and settings\%username%\my documents\mailbox - Modifies the shortcut The shortcut is in C:\documents and settings\all users\desktop Shortcut target should be: C:\Novell\GroupWise\grpwise.exe /pc-"c:\documents and settings\%username%\my documents\mailbox" /ipa-10.101.10.3 /ipp-1677 /@u-? /bl - Deletes the text file Like I said they both only need to run once on each computer and they will be pushed out as domain scripts. Again I thank you for all of your help. |
|
#8
|
||||
|
||||
|
Ok, I'll get this put together. One more question, though. Why is this reboot necessary? I'm not seeing a "need" for it.
|
|
#9
|
|||
|
|||
|
Registry Changes
I thought it had to be done in 2 scripts. The users are restricted users so they don't have permissions to edit the registry or make changes to the all users profile. The GroupWise shortcut that needs to be changed is in the desktop folder of the all users profile. If it can be done in 1 script that would be great. Like I said, I am not programmer so I am unsure how to do this or how it can be done. I appreciate all your help on this. Plus to grab the user name, I thought the reboot was required.
|
|
#10
|
||||
|
||||
|
Quote:
|
![]() |
| Viewing: ASP Free Forums > System Administration > Windows Scripting > VBScript - Scripting and the Registry |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|