#64783 - 2002-04-22 05:06 PM
Mapping a drive and change registry setting to use it
|
drob
Fresh Scripter
Registered: 2002-04-22
Posts: 5
|
I am creating a script that will map different drives and also change a registry setting to use one of the newly mapped drives. I am not having a problem with mapping the drives, but I am not sure how to do the registry setting.
The registry setting I want to edit is "HKEY_CURRENT_USER\Software\Policies\Microsoft\Office\9.0\Common\General\SharedTemplates
It currentlly has a UNC path name but I want to change it to the T drive. Here is the statemant I was using to do this. WriteValue("HKEY_CURRENT_USER\Software\Policies\Microsoft\Office\9.0\Common\General", "SharedTemplates", "T:\", "REG_EXPAND_SZ")
I have this statement after I haved mapped the T drive, and the T drive is getting mapped.
Thanks for the help in advance.
|
|
Top
|
|
|
|
#64784 - 2002-04-22 06:27 PM
Re: Mapping a drive and change registry setting to use it
|
BrianTX
Korg Regular
Registered: 2002-04-01
Posts: 895
|
A couple questions:
1. Should it be REG_SZ or REG_EXPAND_SZ?
2. What kind of client operating systems are you running? Secure operating systems like Windows NT may not accept registry settings if the user is not a local administrator.
3. Have you tried using @ERROR and @SERROR to return values if your WRITEVALUE is failing?
4. Have you tried running just the WRITEVALUE portion of the script from a local drive on the PC to see if it works as intended?
Brian
|
|
Top
|
|
|
|
#64785 - 2002-04-22 07:28 PM
Re: Mapping a drive and change registry setting to use it
|
drob
Fresh Scripter
Registered: 2002-04-22
Posts: 5
|
We are running NT 4.0 workstations and servers. The current registry setting for this key is REG_EXPAND_SZ. I have tried to run it on just my workstation, and it does not work that way either. As far as rights are concerned, I can open up regedt32 and manually change that setting to the T drive, So I would think if I ran the script under my logon it would have the same rights, but I maybe wrong.
|
|
Top
|
|
|
|
#64786 - 2002-04-22 09:03 PM
Re: Mapping a drive and change registry setting to use it
|
BrianTX
Korg Regular
Registered: 2002-04-01
Posts: 895
|
Have you tried checking @ERROR and @SERROR?
I tried it on my system (Office 2000,Win2000 Pro) and it failed because the key SharedTemplates did not exist. It gave the error 2 - "The system cannot find the file specified".
Brian
|
|
Top
|
|
|
|
#64787 - 2002-04-22 09:45 PM
Re: Mapping a drive and change registry setting to use it
|
drob
Fresh Scripter
Registered: 2002-04-22
Posts: 5
|
Sorry, forgot to add that portion of info. It returns 2 also. The key is there. That key holds the setting for workgroup templates within Word.
|
|
Top
|
|
|
|
#64788 - 2002-04-22 10:13 PM
Re: Mapping a drive and change registry setting to use it
|
BrianTX
Korg Regular
Registered: 2002-04-01
Posts: 895
|
I'm a bit stumped, unless it's a syntax error of some sort that isn't showing up here...
Have you tried modifying other registry values?
Brian
|
|
Top
|
|
|
|
#64789 - 2002-04-22 10:27 PM
Re: Mapping a drive and change registry setting to use it
|
NTDOC
Administrator
   
Registered: 2000-07-28
Posts: 11634
Loc: Space
|
Hello Drob,
I am unable to locate that Registry entry on my system under the location you give. I do have the entry under another location.
HKEY_CURRENT_USER\Software\Microsoft\Office\9.0\Common\General
Please try the following code which should work with either KiXtart v3.63 or v4.02
code:
$TemplateVal = "T:\" IF INSTR(READVALUE("HKEY_CURRENT_USER\Software\Microsoft\Office\9.0\Common\General","SharedTemplates"),$TemplateVal) ? "Value for SharedTemplates is correct" ELSE ? "Value for SharedTemplates was not valid, script has now modified value to " +$TemplateVal $x=WriteValue("HKEY_CURRENT_USER\Software\Microsoft\Office\9.0\Common\General","SharedTemplates","$TemplateVal","REG_EXPAND_SZ") ENDIF
Please post an update to let us know if this is working or not, and or if the location you specify is correct. Normally items under POLICY should be set from a policy editor. [ 22 April 2002, 22:28: Message edited by: NTDOC ]
|
|
Top
|
|
|
|
#64790 - 2002-04-22 10:36 PM
Re: Mapping a drive and change registry setting to use it
|
drob
Fresh Scripter
Registered: 2002-04-22
Posts: 5
|
It's amazing what happens when you put the correct Key path in. That is what I get for taking a shortcut and pasting the path from microsoft's website. Should have known microsoft would have had it wrong. Thanks again for your help.
|
|
Top
|
|
|
|
#64791 - 2002-04-22 10:39 PM
Re: Mapping a drive and change registry setting to use it
|
NTDOC
Administrator
   
Registered: 2000-07-28
Posts: 11634
Loc: Space
|
No problem, you're welcome
I'm glad I could help.
|
|
Top
|
|
|
|
Moderator: Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 641 anonymous users online.
|
|
|