Windows Scripting
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Iron Speed
Go Back   ASP Free ForumsSystem AdministrationWindows Scripting

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
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  
Old April 2nd, 2008, 02:52 PM
stiltz79 stiltz79 is offline
Registered User
Click here for more information
 
Join Date: Apr 2008
Location: Cleveland, OH
Posts: 5 stiltz79 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 8 m 6 sec
Reputation Power: 0
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.

Reply With Quote
  #2  
Old April 3rd, 2008, 01:50 AM
Nilpo's Avatar
Nilpo Nilpo is offline
ASP Free Novice (500 - 999 posts)
 
Join Date: Jun 2006
Location: Salem, OH
Posts: 675 Nilpo User rank is Major (30000 - 40000 Reputation Level)Nilpo User rank is Major (30000 - 40000 Reputation Level)Nilpo User rank is Major (30000 - 40000 Reputation Level)Nilpo User rank is Major (30000 - 40000 Reputation Level)Nilpo User rank is Major (30000 - 40000 Reputation Level)Nilpo User rank is Major (30000 - 40000 Reputation Level)Nilpo User rank is Major (30000 - 40000 Reputation Level)Nilpo User rank is Major (30000 - 40000 Reputation Level)Nilpo User rank is Major (30000 - 40000 Reputation Level)Nilpo User rank is Major (30000 - 40000 Reputation Level)  Folding Points: 156663 Folding Title: Super Ultimate Folder - Level 1Folding Points: 156663 Folding Title: Super Ultimate Folder - Level 1Folding Points: 156663 Folding Title: Super Ultimate Folder - Level 1Folding Points: 156663 Folding Title: Super Ultimate Folder - Level 1Folding Points: 156663 Folding Title: Super Ultimate Folder - Level 1Folding Points: 156663 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Days 18 h 35 m 6 sec
Reputation Power: 308
Send a message via ICQ to Nilpo Send a message via AIM to Nilpo Send a message via MSN to Nilpo Send a message via Yahoo to Nilpo Send a message via Google Talk to Nilpo Send a message via Skype to Nilpo
MySpace
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:
Original - vb Code
  1. Set WshNetwork = CreateObject("WScript.Network")
  2. AccountName = WshNetwork.UserName


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!


Reply With Quote
  #3  
Old April 8th, 2008, 07:44 AM
stiltz79 stiltz79 is offline
Registered User
Click here for more information
 
Join Date: Apr 2008
Location: Cleveland, OH
Posts: 5 stiltz79 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 8 m 6 sec
Reputation Power: 0
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.

Reply With Quote
  #4  
Old April 8th, 2008, 10:07 PM
Nilpo's Avatar
Nilpo Nilpo is offline
ASP Free Novice (500 - 999 posts)
 
Join Date: Jun 2006
Location: Salem, OH
Posts: 675 Nilpo User rank is Major (30000 - 40000 Reputation Level)Nilpo User rank is Major (30000 - 40000 Reputation Level)Nilpo User rank is Major (30000 - 40000 Reputation Level)Nilpo User rank is Major (30000 - 40000 Reputation Level)Nilpo User rank is Major (30000 - 40000 Reputation Level)Nilpo User rank is Major (30000 - 40000 Reputation Level)Nilpo User rank is Major (30000 - 40000 Reputation Level)Nilpo User rank is Major (30000 - 40000 Reputation Level)Nilpo User rank is Major (30000 - 40000 Reputation Level)Nilpo User rank is Major (30000 - 40000 Reputation Level)  Folding Points: 156663 Folding Title: Super Ultimate Folder - Level 1Folding Points: 156663 Folding Title: Super Ultimate Folder - Level 1Folding Points: 156663 Folding Title: Super Ultimate Folder - Level 1Folding Points: 156663 Folding Title: Super Ultimate Folder - Level 1Folding Points: 156663 Folding Title: Super Ultimate Folder - Level 1Folding Points: 156663 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Days 18 h 35 m 6 sec
Reputation Power: 308
Send a message via ICQ to Nilpo Send a message via AIM to Nilpo Send a message via MSN to Nilpo Send a message via Yahoo to Nilpo Send a message via Google Talk to Nilpo Send a message via Skype to Nilpo
MySpace
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.
Comments on this post
stiltz79 agrees: I appreciate all his help...

Reply With Quote
  #5  
Old April 9th, 2008, 07:01 AM
stiltz79 stiltz79 is offline
Registered User
Click here for more information
 
Join Date: Apr 2008
Location: Cleveland, OH
Posts: 5 stiltz79 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 8 m 6 sec
Reputation Power: 0
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.

Reply With Quote
  #6  
Old April 9th, 2008, 05:00 PM
Nilpo's Avatar
Nilpo Nilpo is offline
ASP Free Novice (500 - 999 posts)
 
Join Date: Jun 2006
Location: Salem, OH
Posts: 675 Nilpo User rank is Major (30000 - 40000 Reputation Level)Nilpo User rank is Major (30000 - 40000 Reputation Level)Nilpo User rank is Major (30000 - 40000 Reputation Level)Nilpo User rank is Major (30000 - 40000 Reputation Level)Nilpo User rank is Major (30000 - 40000 Reputation Level)Nilpo User rank is Major (30000 - 40000 Reputation Level)Nilpo User rank is Major (30000 - 40000 Reputation Level)Nilpo User rank is Major (30000 - 40000 Reputation Level)Nilpo User rank is Major (30000 - 40000 Reputation Level)Nilpo User rank is Major (30000 - 40000 Reputation Level)  Folding Points: 156663 Folding Title: Super Ultimate Folder - Level 1Folding Points: 156663 Folding Title: Super Ultimate Folder - Level 1Folding Points: 156663 Folding Title: Super Ultimate Folder - Level 1Folding Points: 156663 Folding Title: Super Ultimate Folder - Level 1Folding Points: 156663 Folding Title: Super Ultimate Folder - Level 1Folding Points: 156663 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Days 18 h 35 m 6 sec
Reputation Power: 308
Send a message via ICQ to Nilpo Send a message via AIM to Nilpo Send a message via MSN to Nilpo Send a message via Yahoo to Nilpo Send a message via Google Talk to Nilpo Send a message via Skype to Nilpo
MySpace
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.

Reply With Quote
  #7  
Old April 10th, 2008, 07:49 AM
stiltz79 stiltz79 is offline
Registered User
Click here for more information
 
Join Date: Apr 2008
Location: Cleveland, OH
Posts: 5 stiltz79 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 8 m 6 sec
Reputation Power: 0
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.

Reply With Quote
  #8  
Old April 13th, 2008, 08:42 PM
Nilpo's Avatar
Nilpo Nilpo is offline
ASP Free Novice (500 - 999 posts)
 
Join Date: Jun 2006
Location: Salem, OH
Posts: 675 Nilpo User rank is Major (30000 - 40000 Reputation Level)Nilpo User rank is Major (30000 - 40000 Reputation Level)Nilpo User rank is Major (30000 - 40000 Reputation Level)Nilpo User rank is Major (30000 - 40000 Reputation Level)Nilpo User rank is Major (30000 - 40000 Reputation Level)Nilpo User rank is Major (30000 - 40000 Reputation Level)Nilpo User rank is Major (30000 - 40000 Reputation Level)Nilpo User rank is Major (30000 - 40000 Reputation Level)Nilpo User rank is Major (30000 - 40000 Reputation Level)Nilpo User rank is Major (30000 - 40000 Reputation Level)  Folding Points: 156663 Folding Title: Super Ultimate Folder - Level 1Folding Points: 156663 Folding Title: Super Ultimate Folder - Level 1Folding Points: 156663 Folding Title: Super Ultimate Folder - Level 1Folding Points: 156663 Folding Title: Super Ultimate Folder - Level 1Folding Points: 156663 Folding Title: Super Ultimate Folder - Level 1Folding Points: 156663 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Days 18 h 35 m 6 sec
Reputation Power: 308
Send a message via ICQ to Nilpo Send a message via AIM to Nilpo Send a message via MSN to Nilpo Send a message via Yahoo to Nilpo Send a message via Google Talk to Nilpo Send a message via Skype to Nilpo
MySpace
Ok, I'll get this put together. One more question, though. Why is this reboot necessary? I'm not seeing a "need" for it.

Reply With Quote
  #9  
Old April 13th, 2008, 09:04 PM
stiltz79 stiltz79 is offline
Registered User
Click here for more information
 
Join Date: Apr 2008
Location: Cleveland, OH
Posts: 5 stiltz79 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 8 m 6 sec
Reputation Power: 0
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.

Reply With Quote
  #10  
Old April 14th, 2008, 08:51 PM
Nilpo's Avatar
Nilpo Nilpo is offline
ASP Free Novice (500 - 999 posts)
 
Join Date: Jun 2006
Location: Salem, OH
Posts: 675 Nilpo User rank is Major (30000 - 40000 Reputation Level)Nilpo User rank is Major (30000 - 40000 Reputation Level)Nilpo User rank is Major (30000 - 40000 Reputation Level)Nilpo User rank is Major (30000 - 40000 Reputation Level)Nilpo User rank is Major (30000 - 40000 Reputation Level)Nilpo User rank is Major (30000 - 40000 Reputation Level)Nilpo User rank is Major (30000 - 40000 Reputation Level)Nilpo User rank is Major (30000 - 40000 Reputation Level)Nilpo User rank is Major (30000 - 40000 Reputation Level)Nilpo User rank is Major (30000 - 40000 Reputation Level)  Folding Points: 156663 Folding Title: Super Ultimate Folder - Level 1Folding Points: 156663 Folding Title: Super Ultimate Folder - Level 1Folding Points: 156663 Folding Title: Super Ultimate Folder - Level 1Folding Points: 156663 Folding Title: Super Ultimate Folder - Level 1Folding Points: 156663 Folding Title: Super Ultimate Folder - Level 1Folding Points: 156663 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Days 18 h 35 m 6 sec
Reputation Power: 308
Send a message via ICQ to Nilpo Send a message via AIM to Nilpo Send a message via MSN to Nilpo Send a message via Yahoo to Nilpo Send a message via Google Talk to Nilpo Send a message via Skype to Nilpo
MySpace
Quote:
Originally Posted by stiltz79
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.
The logon script will execute with Administrator privileges. And there is no reboot required for getting the user name. Looks like we can do this all in one go.

Reply With Quote
Reply

Viewing: ASP Free ForumsSystem AdministrationWindows Scripting > VBScript - Scripting and the Registry


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump