Regedit /s and XP Pro 
Author Message
 Regedit /s and XP Pro

I am running a login VBScript that incorporates several regedit commands for
importing registry settings.  Working fine when logging into Win9x, WinNT,
or Win2K workstations but the regedit command fails on an XP Pro machine
(Administrator has disabled registry editing tools.....).  Yes, that policy
is set in a GPO.  Why does it work on Win2K/NT and not XP Pro?  What has
changed?  Where can I get more information?

Thanks.




Sun, 19 Sep 2004 20:35:59 GMT  
 Regedit /s and XP Pro

Quote:

> I am running a login vbscript that incorporates several regedit commands for
> importing registry settings.  Working fine when logging into Win9x, WinNT,
> or Win2K workstations but the regedit command fails on an XP Pro machine
> (Administrator has disabled registry editing tools.....).  Yes, that policy
> is set in a GPO.  Why does it work on Win2K/NT and not XP Pro?  What has
> changed?  Where can I get more information?

Can't you use VBScripts (or WMIs) registry methods to update the registry
instead?

--
torgeir



Sun, 19 Sep 2004 21:35:39 GMT  
 Regedit /s and XP Pro
Hi,

I use the REG.EXE from the Windows 2000 resource kit. It does merge .REG
files even when the policy is set. (so REG.EXE IMPORT yourregfile.reg)

greetz,

Ernst

P.S: I'm not reading this group frequently, so sent replies to my e-mail
address (note the NOSPAM!)


Quote:

> > I am running a login vbscript that incorporates several regedit commands
for
> > importing registry settings.  Working fine when logging into Win9x,
WinNT,
> > or Win2K workstations but the regedit command fails on an XP Pro machine
> > (Administrator has disabled registry editing tools.....).  Yes, that
policy
> > is set in a GPO.  Why does it work on Win2K/NT and not XP Pro?  What has
> > changed?  Where can I get more information?

> Can't you use VBScripts (or WMIs) registry methods to update the registry
> instead?

> --
> torgeir



Sun, 19 Sep 2004 23:27:48 GMT  
 Regedit /s and XP Pro
Thank you for the responses.

I am in fact using many RegWrite commands in the login script but there are
some long hex values that I cannot get written to the registry (example - 00
00 02 01 0c cd 44 32 .... and so on).  That is the only reason I use the
Shell.Run "regedit /s regfile.reg" command.  I have not looked at WMI for
alternative methods of posting to the registry so I will take a look into
that.  Do you know if that will handle large/long hex values or if there is
a way to write those values with a RegWrite command??

Thanks again.

S


Quote:

> > I am running a login vbscript that incorporates several regedit commands
for
> > importing registry settings.  Working fine when logging into Win9x,
WinNT,
> > or Win2K workstations but the regedit command fails on an XP Pro machine
> > (Administrator has disabled registry editing tools.....).  Yes, that
policy
> > is set in a GPO.  Why does it work on Win2K/NT and not XP Pro?  What has
> > changed?  Where can I get more information?

> Can't you use VBScripts (or WMIs) registry methods to update the registry
> instead?

> --
> torgeir



Mon, 20 Sep 2004 20:27:48 GMT  
 Regedit /s and XP Pro
Ernst,

Thanks for the hint  - I will take a look at REG.EXE.

S


Quote:
> Hi,

> I use the REG.EXE from the Windows 2000 resource kit. It does merge .REG
> files even when the policy is set. (so REG.EXE IMPORT yourregfile.reg)

> greetz,

> Ernst

> P.S: I'm not reading this group frequently, so sent replies to my e-mail
> address (note the NOSPAM!)




> > > I am running a login vbscript that incorporates several regedit
commands
> for
> > > importing registry settings.  Working fine when logging into Win9x,
> WinNT,
> > > or Win2K workstations but the regedit command fails on an XP Pro
machine
> > > (Administrator has disabled registry editing tools.....).  Yes, that
> policy
> > > is set in a GPO.  Why does it work on Win2K/NT and not XP Pro?  What
has
> > > changed?  Where can I get more information?

> > Can't you use VBScripts (or WMIs) registry methods to update the
registry
> > instead?

> > --
> > torgeir



Mon, 20 Sep 2004 20:28:52 GMT  
 Regedit /s and XP Pro

Quote:

> I have not looked at WMI for
> alternative methods of posting to the registry so I will take a look into
> that.  Do you know if that will handle large/long hex values

Yes.

SetBinaryValue Method in Class StdRegProv
http://msdn.microsoft.com/library/en-us/wmisdk/r_prov_6rzq.asp

From an old article:

<qoute>

Subject: Re: RegWrite errors
Newsgroups: microsoft.public.scripting.wsh
Date: 2001-02-19 07:16:27 PST

(this is probably a lot more than you expected and I spent a fair amount of time
(several hours) researching this ;-).  But this question has come up so many
times without a really good answer that I thought it would be an interesting
exercise.)

RegObj.dll and also WMI's StdRegProv (Standard Registry Provider) both come
close.  The problem is that both require a true byte array to write REG_BINARY
keys/values and VBScript can only create an array of variants of subtype byte.

There is hope for creating byte arrays in script (OK, a it's a free component
that creates them FOR script)!

Q250344 - SAMPLE: ARRAYCONVERT.EXE Variant Conversion Functions
http://support.microsoft.com/support/kb/articles/Q250/3/44.ASP

for a component (ADs.ArrayConvert) that helps with byte arrays.  It was supposed
to be part of the ADSI SDK samples (but still isn't).

Here's a WMI StdRegProv example that uses it.

(Note: The code below isn't generally the way that I would use On Error Resume
Next.  This example is adapted from WMI VB code examples.  I suspect the On
Error Resume Next isn't really necessary.  The long return value being non-zero
should be sufficient error checking.  In the cases where I messed up
experimenting, I got non-zero return values, but no other runtime (Err object)
errors.)

'=====
' StdRegProv
' http://msdn.microsoft.com/library/psdk/wmisdk/regprovref_6yie.htm
'
' For info on the ADs.ArrayConvert component, see
'
' Q250344 - SAMPLE: ARRAYCONVERT.EXE Variant Conversion Functions
' http://support.microsoft.com/support/kb/articles/Q250/3/44.ASP
'
'=====

Dim objRegistry
set objRegistry = GetObject("winmgmts://./root/default:StdRegProv")

Const HKEY_LOCAL_MACHINE = &H80000002

Dim lRC
Dim sPath
Dim strHex
Dim binArray

Dim cnvt
Set cnvt = CreateObject("ADs.ArrayConvert")
strHex = "11223344"
binArray = cnvt.CvHexStr2vOctetStr(strHex)

'========IMPORTANT==========
' The key *MUST* already exist for
' a named value to be created or
' updated with SetBinaryValue() so
' we create it here.  Note that it is
' NOT an error to call CreateKey() for
' a key that already exists...
'===========================
sPath = "SOFTWARE\MyKey"
On Error Resume Next
lRC = objRegistry.CreateKey(HKEY_LOCAL_MACHINE, sPath)

If (lRC = 0) And (Err.Number = 0) Then
    'Do something
Else
    'An error occurred
    msgbox lrc
    msgbox err.description
    wscript.quit
End If

lRC = objRegistry.SetBinaryValue(HKEY_LOCAL_MACHINE, sPath, _
                                 "MyBinaryNamedValue", binArray)

If (lRC = 0) And (Err.Number = 0) Then
    'Do something
Else
    'An error occurred
    msgbox lrc
    msgbox err.description
End If

================================================
</qoute>

Quote:
> or if there is
> a way to write those values with a RegWrite command??

There aren't.

--
torgeir



Mon, 20 Sep 2004 21:21:40 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. WSHController with XP Pro and XP Home

2. cdonts in Windows XP Pro

3. Problem: VBS Mapping a Drive in XP Pro

4. XP Pro, Access, "Undefined Error"

5. FileSystemObject lockup under XP Pro

6. NO CDONTS in XP Pro?

7. Can't use File System Object on XP Pro

8. FileSystemObject in XP PRO

9. Problem: VBS Mapping a Drive in XP Pro

10. WSH 5.6 and Script Debugger on XP Pro problems

11. WSC and Windows XP pro

12. ASP Debugging in WinXP Pro/Office XP Dev

 

 
Powered by phpBB® Forum Software