Re: Error 0x8007043B after XP SP2

From: Torgeir Bakken \(MVP\) (Torgeir.Bakken-spam_at_hydro.com)
Date: 09/06/04


Date: Mon, 06 Sep 2004 04:05:08 +0200

mark@no.spam wrote:

> Thanks for your reply.
>
> Would you happen to know WHY these services would have gone missing
> from the registry? I have another XP Pro 2002 (SP1) system, and these
> services are there.....

No, I don't know.

> Also, is it possible to write a REG file that would update this key,
> which is a REG_MULTI_SZ, and insert these services if they are not
> already there? I don't know the syntax for that....

No, you cannot use a REG file for this, because the list of services
in that value can be different from computer to computer.

But you can use a VBScript to do this. Below is a VBScript that
checks if BITS and wuauserv is listed in the registry value netsvcs,
and if not, adds them.

Put it a file named e.g. NetsvcsWUChk.vbs

'--------------------8<----------------------

Const HKLM = &H80000002

arrNeededSvcs = Array("BITS","wuauserv")

strKeyPath = "SOFTWARE\Microsoft\Windows NT\CurrentVersion\SvcHost"
strValueName = "netsvcs"

strComputer = "." ' "use "." for local computer
Set objReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" _
                  & strComputer & "\root\default:StdRegProv")

objReg.GetMultiStringValue HKLM, strKeyPath, strValueName, arrValues

' create string from array, easier to check for existence this way
strValues = "|" & Join(arrValues, "|") & "|"

bolUpdateNeeded = False ' init value

For Each strNeededSvcs In arrNeededSvcs
   If InStr(1, strValues, strNeededSvcs, vbTextCompare) = 0 Then
     ' service is not in array, add it
     intArrCount = UBound(arrValues) + 1
     ReDim Preserve arrValues(intArrCount)
     arrValues(intArrCount) = strNeededSvcs
     bolUpdateNeeded = True
   End If
Next

If bolUpdateNeeded Then
   objReg.SetMultiStringValue HKLM, strKeyPath, strValueName, arrValues
End If

MsgBox "Done!", vbInformation + vbSystemModal, "Netsvcs check"

'--------------------8<----------------------

-- 
torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and an ONLINE version of
the 1328 page Scripting Guide:
http://www.microsoft.com/technet/scriptcenter/default.mspx


Relevant Pages

  • [NT] Norton Anti-Virus VB Scripting Vulnerability
    ... The following security advisory is sent to the securiteam mailing list, and can be found at the SecuriTeam web site: http://www.securiteam.com ... Set objRegistry = ... objRegistry.SetStringValue HKEY_LOCAL_MACHINE, strKeyPath, strValueName, ...
    (Securiteam)
  • Re: Nooblet scripting coder here - database search question
    ... Your Variable strComputer, Why do you declare it twice, once should be enough. ... How much did you read up in the Scripting center. ... strValueName = "Database" ... Set colSettings = objWMIService.ExecQuery _ ...
    (microsoft.public.windowsxp.setup_deployment)
  • Re: What is the default registry permission for HKLM?
    ... I tried adding entires at existing sub branches of HKLM ... I'm trying to use Windows scripting to ...
    (microsoft.public.windowsxp.security_admin)
  • Re: Registry question
    ... say Virus Scan Version if I am already using the strKeyPath in the script? ... I find the correct version in the registry and I then want to delete the ... >> this is the subkey that I need to delete. ... > torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway ...
    (microsoft.public.scripting.vbscript)
  • Re: REGWrite command
    ... I made it work by adding the createkey method: ... >> I'm trying to make a key name called ProtocolOrder under the strKeyPath ... > it works fine as it is (for a local computer). ... > torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway ...
    (microsoft.public.scripting.wsh)